Q:

Write a C program to print ASCII value of entered character

0

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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 .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Basic Solved Programs – C Programming

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C Program to input values into an array an... >>
<< Write a C program to convert feet to inches...