Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

C Program to find the ASCII value of any character

In this post, we are going to write a simple C Program to find the Ascii value of any character that a user has entered. If you what is an ASCII value, I will give a simple example here,

Each character whether it can be an Alphabet or Number or Any Symbol holds an ASCII value. For eg., the ASCII value of A is 65 and a is 97 and also for & is 38. So we can easily find out these ASCII values by writing a simple C Program.

Here is the C program to find and print the ASCII value of a character:

//program to find ASCII value of a character
#include 
int main() {  
    char c;
    printf("Enter any character (eg., A or a or $ or 5): ");
    scanf("%c", &c);  
    
    // %d to display the value of the character
    // %c to display the entered character
    printf("ASCII value of %c is %d", c, c);
    
    return 0;
}

And the sample output of the above program is:

Enter any character (eg., A or a or $ or 5): 5
ASCII value of 5 is 53
--------------------------------
Process exited after 2.726 seconds with return value 0
Press any key to continue . . .

I hope this program is very helpful for you. Subscribe to this blog for more new updates.

The post C Program to find the ASCII value of any character appeared first on TutorialsMade.



This post first appeared on TutorialsMade - Ultimate Tutorial, please read the originial post: here

Share the post

C Program to find the ASCII value of any character

×

Subscribe to Tutorialsmade - Ultimate Tutorial

Get updates delivered right to your inbox!

Thank you for your subscription

×