C program to print a character and its ASCII Value
ASCII (American Standard Code for Information Interchange) is the most common format for text files in computers and on the Internet. In an ASCII
file, each alphabetic, numeric, or special character is represented
with a 7-bit binary number (a string of seven 0s or 1s). 128 possible
characters are defined. Computers can only understand numbers, so an ASCII code is the numerical
representation of a character such as 'a' or '@' or an action of some sort.
ASCII was developed a long time ago and now the non-printing characters are
rarely used for their original purpose.
ASCII was actually designed for use with teletypes and so the descriptions
are somewhat obscure. If someone says they want your CV however in ASCII format, all
this means is they want 'plain' text with no formatting such as tabs, bold or
underscoring - the raw format that any computer can understand. This is usually
so they can easily import the file into their own applications without issues.
Notepad.exe creates ASCII text, or in MS Word you can save a file as 'text only'.
int main()
{
char a;
printf("Enter a character\n");
scanf("%c",&a);
printf("Entered character is %c\n",a);
printf("Decimal ASCII Value of %c is %d",a,a);
return 0;
}
m
Entered character is m
Decimal ASCII Value of m is 109
PROGRAM:
#include <stdio.h>int main()
{
char a;
printf("Enter a character\n");
scanf("%c",&a);
printf("Entered character is %c\n",a);
printf("Decimal ASCII Value of %c is %d",a,a);
return 0;
}
OUTPUT:
Enter a characterm
Entered character is m
Decimal ASCII Value of m is 109