C Program to ASCII value of a character

A character denotes any alphabet, digit or any special symbol. In C there is a ASCII value for every character. Here is simple C program to print ASCII value of any character.
#include<stdio.h>
int main()
{
 char ch;
 printf("Enter a character: ");
 scanf("%c",&ch);
 printf("ASCII value of %c = %d\n",ch,ch);
 return 0;
}
Another C program to print ASCII value for all characters
#include<stdio.h>
int main()
{
 int i;
 for(i=0;i<=127;i++)
 {
 printf("ASCII value for character %c = %d \n",i,i);
 }
 return 0;
}



Popular posts from this blog