;

C Program to Print ASCII Value of Character


Tutorialsrack 03/11/2019 C

In this C program, we will learn how to write a program to print the ASCII value of the character.

Here is the code of the program to print the ASCII value of the character.

Code - C Program to Print ASCII Value of Character
/*C Program to Print ASCII Value of Character*/

#include <stdio.h>
int main()
{
    char c;
    printf("Enter a character: ");
    // Reads character input from the user
    scanf("%c", &c);  
    
    // %d displays the integer value of a character
    // %c displays the actual character
    printf("ASCII value of %c = %d", c, c);
    return 0;
}
Output

Enter a character: T
ASCII value of T = 84
--------------------------------
Process exited after 4.517 seconds with return value 0
Press any key to continue . . .


Related Posts



Comments

Recent Posts
Tags