#include <stdio.h>
int main()
{
char ch;
printf(“Enter a character: “);
scanf(“%c”, &ch);
printf(“ASCII value of %c = %d”, ch, ch);
return 0;
}
char ch; → Declares a character variable.scanf("%c", &ch); → Reads a character from the user.printf("%d", ch); → Displays the ASCII value of the character.This website uses cookies.