This program asks user to check whether the given char code is ASCII or not. ASCII code means the character code that brings in a numeric form for every character so that computer can read the content because computer only understands the machine language or binary system. ASCII stands for (American standard code for information interchange). There are different type of ASCII code like for Capital characters ASCII code numeric value starts from 65 (A=65) or small characters like a starts from 97 (a=97).
In this program user need to check out the ASCII code for character for this user declare a variable name m1 that will be contain the value for ASCII code checking process. User uses control statement for checking the ASCII code. User asks to enter the value as character. if(m1>=65&&m1<=90) then the character value will be added with 32 to find out the ASCII value else the condition will be if(m1>=97&&m1<=122) then the value will be deducted from 32. And if not any condition lies true then message will be nothing for both character values.
Problem Statement:
This is C program to check out the ASCII code value for character.
- Declare the variables.
- Using control statements.
- Display result on the screen.
Here is C source code for Checking out the ASCII value for character. Output of this program shown below.
#include<stdio.h>
void main()
{
char m1,m2;
clrscr();
printf("Enter any Char : ");
scanf("%c",&m1);
if(m1>=65&&m1<=90)
{
m2=m1+32;
printf("m2 : %c",m2);
}
else if(m1>=97&&m1<=122)
{
m2=m1-32;
printf("m2 : %c",m2);
}
else
printf("Nothing");
getch();
}