Monday, May 27, 2019

Program to Print ASCII Value

Write a C Program to find ASCII Value of a Character

Program:

#include <stdio.h>
int main()
{
    char c;
    printf("Enter a character: ");
    scanf("%c", &c); 
    printf("ASCII value of %c = %d", c, c);
    return 0;
}

 d : the integer value of a character
 c :  the actual character

Output:

Enter a character: G
ASCII value of G = 71
--------------------------------
Process exited after 4.356 seconds with return value 0
Press any key to continue . . .

0 Comments:

Post a Comment