Problem statement
Write a program to take character as input and find ASCII value of given character.
What is meant by ASCII value?
There are 256 different types of characters available in computers. Each character has their unique ASCII value.
The value range from 0 to 255. Out of the 256, first 128 are often called ASCII characters and the next 128 as Extended ASCII characters.
Most computers typically reserve 1 byte (8 bits) to represent a character in ASCII.
What is ASCII stands for?
ASCII stands for American Standard Code for Information Interchange.
Program to find ASCII value of character
1 2 3 4 5 6 7 8 9 10 |
#include <stdio.h> int main() { char ch; printf("Enter any character: "); scanf("%c\n", &ch); printf("ASCII value of %c = %d", ch, ch); return 0; } |
Output
1 2 3 |
Enter any character: a 97 |
Program to find ASCII chart
1 2 3 4 5 6 7 8 9 |
#include<stdio.h> int main() { int ch; for(ch=0; ch<=255; ch++) { printf("%d %c\n",ch, ch); } } |