how do I enter a number and return the numer that represents ASCII value.
Such as
"Please enter a number less than 255
65
The character that represents ASCII value 65 is A"
how do I enter a number and return the numer that represents ASCII value.
Such as
"Please enter a number less than 255
65
The character that represents ASCII value 65 is A"
int x;
scanf( "%d", &x );
printf("%d is %c.", x, (char)x );
You don't acutally _have to_ cast it to a char there either...
Quzah.
declare a char type variable to print out the ASCII value. Then use the char the same way you would use an int.
Code:#include <stdio.h> int main(){ char c; printf("Please enter a number from 0 to 256"); scanf("%c", &c); printf("The ASCII value is %c", c); return 0; }