C program to print ASCII value of a characterSimple / By Neeraj Mishra #include<stdio.h> #include<conio.h> void main() { int a; char ch; clrscr(); //to clear the screen printf(“Enter any character:”); scanf(“%c”,&ch); a=ch; printf(“ASCII value of %c is %d”,ch,a); getch(); //to stop the screen }
Sava_Ion December 9, 2013 at 8:43 pm you can write printf("ASCI value of %c is %d",ch,ch);without more lines and variables .. Reply
Md Mamun June 27, 2020 at 7:57 am #include int main() { char c; printf(“Enter a character: “); scanf(“%ch”,&c); printf(“ASCII value of %c=%d”,c,c); return 0; } Reply
you can write
printf("ASCI value of %c is %d",ch,ch);
without more lines and variables ..
#include
int main()
{
char c;
printf(“Enter a character: “);
scanf(“%ch”,&c);
printf(“ASCII value of %c=%d”,c,c);
return 0;
}