• C++ Language

    Find ASCII Value Of A Character In C++

    A character variable holds ASCII value means an integer number between 0 and 127 rather than that character itself in C programming. That value is known as ASCII value. #include <iostream> using namespace std; int main() { char c; cout << "Enter a character: "; cin >> c; cout << "ASCII Value of " << c << " is " << int(c); return 0; } OutPut Enter a character: A ASCII Value of A is 65  

  • C language

    Find ASCII Value For Character

    Here, we are finding ASCII value of any input character. %c is the format specifier to take character as input. Here, when we use %d instead of %c for character variable then it will print integer ASCII value of character. #include<stdio.h> #include<conio.h> void main() { char character; clrscr(); printf("Enter any character : "); scanf("%c" , &character); printf("\n\nASCII value of %c = %d",character,character); getch(); } OutPut Enter any character : s ASCII value of s = 115