Program To Print ASCII Value Of A Character - STechies
Maybe your like
ASCII value is nothing but represents the english character as numbers which means every letter present in english dictionary holds a number from 0 to 127. for example the ASCII value for capital or uppercase A is '65' and ASCII value for small or lowercase a is '97'.
In this article, you will learn how to write a program to find ASCII value of a character in C, C++, JAVA and PHP Language example.
C Program to find ASCII Value of a Character
//C Language program to get ASCII Value //Taking input from user #include<stdio.h> void main(){ char c; //Telling user what to enter printf("Enter a character : "); //Taking input from User scanf("%c",&c); printf("ASCII Value of %c = %d", c, c); }OUTPUT ::
Enter a character : a ASCII Value of a = 97C++ Program to find ASCII Value of a Character
//C++ Program to get the ASCII value //Taking input from user //Including the input/Output Stream Library of CPP #include<iostream> using namespace std; //Main method of the program int main(){ //Declaring a character type variable char c; //Talling user what to enter cout << "Enter a character / Nmumber : "; //Taking input from user cin >> c; //Printing the result cout << "ASCII Vaule for " << c << " is : " << int(c); return 0; }OUTPUT ::
Enter a character / Nmumber : @ ASCII Vaule for @ is : 64JAVA Program to find ASCII Value of a Character
//Java Program to get the ASCII Value //Taking input from user //importing Scanner Class for taking input from user import java.util.Scanner; //Main Class of Program public class Main{ //Main Method of the program public static void main (String[] args) { //Creating the object of Scanner Class Scanner input = new Scanner(System.in); //Telling user what to enter System.out.print("Enter a Character / Number : "); //String user input character in variale `c` of Character type char c = input.next().charAt(0); /* *Printing the result { (int) will convert the character type value into * it'e equilent integer value } */ System.out.println("ASCII VALUE IS : " + (int) c); } }OUTPUT ::
Enter a Character / Number : a ASCII VALUE IS : 97PHP Program to find ASCII Value of a Character
<?php // PHP Program to get the ASCII Value //Using Ord Method //Declaring and Initilizing the character $inputVariable = 'a'; //Printing Output echo "ASCII VALUE FOR ".$inputVariable." is ".ord($inputVariable);OUTPUT ::
ASCII VALUE FOR a is 97Tag » How To Get Ascii Value Of Char In C++
-
Get ASCII Value Of Char In C++ | Delft Stack
-
C++ Program To Find ASCII Value Of A Character - Programiz
-
Program To Print ASCII Value Of A Character - GeeksforGeeks
-
C++ Program To Print ASCII Value Of All Characters In The String
-
How To Convert An ASCII Char To Its ASCII Int Value? - Stack Overflow
-
Convert ASCII To Char In C++ - Java2Blog
-
ASCII Chart
-
How Do You Find The ASCII Value Of A Character? - MakeUseOf
-
C++ Program To Find ASCII Value Of A Character - Tutorialspoint
-
ASCII Value Of Character In C++ | Programming - PrepInsta
-
Print Character Through ASCII Value Using Cout In C++ - IncludeHelp
-
C++ Program To Find ASCII Value Of Character - Learn ETutorials
-
ASCII Character Set
-
Ascii Value Of A Char In Cpp Code Example - Grepper