The program accepts a character as an input and prints its corresponding ASCII value on output screen.
The ASCII values are ranging from 0 to 128 that cover numbers from 0 to 9, uppercase letters and lowercase letters from a to z and some special characters are also the part of this system.
For example, ASCII value of 0 is 48.
or
Program:
#include <stdio.h> int main() { char value; printf("Enter a Value = "); scanf("%c", &value); printf("integer value of %c = %d\n", value, value); return 0; }
Output:
In case of number
Enter a Value = 0 ASCII integer value of 0 = 48
In case of uppercase letter
Enter a Value = A ASCII integer value of A = 65
In case of lowercase letter
Enter a Value = a ASCII integer value of a = 97
In case of special character
Enter a Value = @ ASCII integer value of @ = 64
Explanation:
This post was last modified on August 26, 2022