#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;
return 0;
}
Output of program
Output of program
Enter any character:A
ASCII value of A is 65
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.