DEV Community

Snehal Rajeev Moon
Snehal Rajeev Moon

Posted on

5 2 1 1 1

Print ANCII value of character

Hello Readers...

In this blog we will see how to find the ANCII value of given character using C and C++.

Program in C

#include <stdio.h>

int main()
{
   char character;
   printf("Enter character of your choice = ");
   scanf("%c", &character);
   printf("value of character is %c = %d", character, character);
}
Enter fullscreen mode Exit fullscreen mode

Output of above program

Image description

No let us see how to write a same program using C++

Program in C++

  #include <iostream>  
    using namespace std;  

    int main () {  
        char character;    
        cout<<"\n \n \t Enter any character = ";    
        cin>>character;
        cout<<"\t ANCII value of character " <<character << " = " << int(character);    
       return 0;  
    }  
Enter fullscreen mode Exit fullscreen mode

Output for above program
Image description

In this way we can find the ANCII value of given character using C and C++.

Thank you for reading.. 🦄 ❤️

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more