#include<stdio.h>
int main()
{
char ch1;
printf("Enter any character:");
scanf("%c",&ch1);
printf("ASCII value of %c is %d ",ch1,ch1);
return 0;
}
Output of program
Enter any character: A
ASCII value of A is 65
This blog assists in mastering C and C++ programming skills from basics to advanced levels.
why ch1,ch1 is taken
ReplyDeleteIn the statement: printf("ASCII value of %c is %d ",ch1,ch1);
Deletewe are using two format specifiers: %c and %d; hence ch1 is written twice.