Write a C program to print ASCII value of entered character

By | 03.11.2016

Print ASCII value of entered character


Write a C program to print ASCII value of entered character. Here’s simple program to print ASCII value of entered character in C Programming Language.


ASCII Character Set


Character data is represented in a computer by using standardized numeric codes which have been developed. The most widely accepted code is called the American Standard Code for Information Interchange ( ASCII).

The ASCII code associates an integer value for each symbol in the character set, such as letters, digits, punctuation marks, special characters, and control characters. Some implementations use other codes for representing characters, but we will use ASCII since it is the most widely used.


Below is the source code for C program to print ASCII value of entered character which is successfully compiled and run on Windows System to produce desired output as shown below :


SOURCE CODE : :


/*  C program to print ASCII value of entered character  */

#include <stdio.h>

int main()
{
    char ch;
    int asciiValue;

    printf("Enter any character: ");
    scanf("%c",&ch);

    asciiValue=(int)ch;

    printf("\nASCII value of character: %c is: %d\n",ch,asciiValue);


}

OUTPUT : :


/*  C program to print ASCII value of entered character  */

*************** FIRST RUN ******************

Enter any character: r

ASCII value of character: r is: 114

*************** SECOND RUN ******************

Enter any character: z

ASCII value of character: z is: 122

*************** THIRD RUN ******************

Enter any character: p

ASCII value of character: p is: 112

Above is the source code for C program to print ASCII value of entered character which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

4 2 votes
Article Rating
Category: Basic Programs C Programming Tags:

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments