fork download
  1. #include <stdio.h>
  2. int main()
  3. {
  4. char c;
  5. printf("Enter a character: ");
  6.  
  7. // Reads character input from the user
  8. scanf("%c", &c);
  9.  
  10. // %d displays the integer value of a character
  11. // %c displays the actual character
  12. printf("ASCII value of %c = %d", c, c);
  13. return 0;
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, or enum expected
#include <stdio.h>
         ^
Main.java:5: error: class, interface, or enum expected
    printf("Enter a character: ");
    ^
Main.java:8: error: class, interface, or enum expected
    scanf("%c", &c);  
    ^
Main.java:12: error: class, interface, or enum expected
    printf("ASCII value of %c = %d", c, c);
    ^
Main.java:13: error: class, interface, or enum expected
    return 0;
    ^
Main.java:14: error: class, interface, or enum expected
}
^
7 errors
stdout
Standard output is empty