Ettianz Blog
Home
Programming
C Language
Dos Command
PSO2
Character Voice Youtube
About me
How to use getchar() function to read and print in ASCII value
Code :
#include
#include
int main(void) { char ch1, ch2, ch3; printf("Enter the first character >"); ch1 = getchar(); printf("Enter the second character >"); fflush(stdin); ch2 = getchar(); printf("Enter the third character >"); fflush(stdin); ch3 = getchar(); printf("\n"); printf("ASCII for character %c is %d.\n", ch1, ch1); printf("ASCII for character %c is %d.\n", ch2, ch2); printf("ASCII for character %c is %d.\n", ch3, ch3); system("pause"); return 0; }
Newer Post
Older Post
Home