C or C++ Program to Calculate ASCII Value of a Character

This article describes the program to calculate ASCII value of a character in C/C++. Let us discuss about ASCII value of a character.

ASCII Value of a Character
ASCII stands for American Standard Code for Information Interchange. Computers can only understand binary numbers. So an ASCII code is the numerical representation of a character such as ‘a’ is 97.

C or C++ Code to Calculate ASCII Value of a Character

#include
#include
#include
int main()
{
    clrscr();
    int a,n,i;
    char y;    
    cout<<"\" This program will whow ASCII value of a character.\""<<endl<<endl;
    cout<<"What is the character ?. Give a character."<<endl;     cin>>y;
    a= int(y);
    cout<<endl<<"ASCII value of "<<y<<" is : "<<a<<endl;
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *