Home C Language Basic C Programs ASCII Values

ASCII Values

Write a C Program to Find ASCII Value of a Character.

#include <stdio.h>

int main()

{

   char c;

   printf(“Enter a character: “);

   scanf(“%c”, &c);

   printf(“ASCII value of %c is %d”, c, c);

   // %d displays the integer value of a character

   return 0;

}

Output:

Enter a character: R

ACSII value of R is 82