Example & Tutorial understanding programming in easy ways.

Write a program to Print ASCII value of any character in C language.

ASCII stands for the American Standard Code for Information Interchange.
-Each symbol or each key on keyboard have unique ASCII value.

program-

#include < stdio.h>
int main()
{
char ch;
printf("Enter any charactern");
scanf("%c",&ch);
printf("ASCII value of %c is %d",ch,ch);
}


output-

Enter any character
a
97

Enter any character
A
65

Enter any character
Z
90


-In this program, we take a character input by the %c.
-To find the ASCII value we just need to print that character by using %d instead of %c.
-In above outputs ASCII value of a=97,A=65 and Z=90




Read More →