charcode.c 272 B

123456789101112
  1. /* charcode.c-displays code number for a character */
  2. #include <stdio.h>
  3. int main(void)
  4. {
  5. char ch;
  6. printf("Please enter a character.\n");
  7. scanf("%c", &ch); /* user inputs character */
  8. printf("The code for %c is %d.\n", ch, ch);
  9. return 0;
  10. }