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);
}
Output of above program
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;
}
In this way we can find the ANCII value of given character using C and C++.
Thank you for reading.. 🦄 ❤️
Top comments (0)