Home » Blog » Find ASCII Value For Character

Find ASCII Value For Character

Here, we are finding ASCII value of any input character.

%c is the format specifier to take character as input.

Here, when we use %d instead of %c for character variable then it will print integer ASCII value of character.

#include<stdio.h>
#include<conio.h>

void main()
{
    char character;
	
    clrscr();
	
    printf("Enter any character : ");
    scanf("%c" , &character);
    printf("\n\nASCII value of %c = %d",character,character);

    getch();
}

OutPut

Enter any character : s


ASCII value of s = 115

 

Leave a Reply

Your email address will not be published.