C program to find Ascii value of character

 In this example, discuss how to find the ASCII value of the character in the c programming language. Following is the solution to this problem.


#include <stdio.h>

int main() {  

    char ch;

    printf("Enter a character: ");

    scanf("%ch", &ch);  


    // %d display the integer value(ascii value) of a character

    // %c display  actual character

    printf("ASCII value of %c = %d", ch, ch);


    return 0;



Enter a character: a

ASCII value of a = 97

Here,take a character input from the user and display its integer value by using %d in printf.


Hire a programmer

Popular posts from this blog

CSS selector

C program to convert decimal to binary number

C Program to convert binary to decimal number