Index « Previous Next »


Every letter, number, or special symbol on your keyboard in memory is stored as numeric (ASCII) code. Write a program that prompts the user to input a character and displays its ASCII code.

Source Code

#include <stdio.h>

int main()
    char letter;

    printf("Enter a character :");
    scanf("%c", &letter);
    printf("ASCII value of %c is %d.", letter, letter);

    return 0;


Enter a character :A
ASCII value of A is 65.