ASCII value character

ASCII Value

ASCII stands for American Standard Code for Information Interchange.The ASCII value of a character is a7-bit integer value between 0 and 127 which represents the character. ASCII values are used for encoding any document or text on computers. It is a standard measure which is to be followed by every single device which helps to store the data in encrypted format.

ascii value

Flowchart to find the ASCII value

Step 1 : START
Step 2 : Read a character c.
Step 3 : Print the ASCII value of c.
Step 4 : END

Working Of Program

In all these following programs, we’ll learn to display the ASCII value of a character. ASCII values are the ones which are stored in the computer. Whatever word or character we type has a special value which is understood by our computer.

Example

ASCII value of character

Problem 1

Write a program to find the ASCII value.

Code

Run
#include
int main() {  
    char c;
    printf("Enter a character: ");
    scanf("%c", &c);  
    printf("ASCII value of %c = %d", c, c);
    return 0;
}

Input

Enter a character: H

Output

ASCII value of H = 72

Problem 2

Write a program to find the ASCII value.

Code

Run

#include<stdio.h>
int main() {  
    char c = 'm';
    printf("The ASCII value of %c is %d", c, c);
    return 0;
}

Output

The ASCII value of m is 109

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription