pTutorial

New way to learn C programming

C Program to find ASCII value

User defined c Program to find the ASCII value of any character, as well as integer by the user.

The numerical representation of any character is known as ASCII values. It is pre-defined standard for representing the character in the computer.

ASCII value of character

#include <stdio.h>
#include <conio.h>
void main()
{
    char chr;
    
    printf("Enter a character range(A-z or a-z): ");
    
	scanf("%c",&chr);       
    
	printf("ASCII value of %c : %d",chr,chr);
    
	getch();
}

Download C Program To Find ASCII Value

Output of program

c program to find ascii value

In the above example, the program asks to the user for entering a character, that will be stored in a character type variable Chr and after that you can print the ASCII value of the character by using "%d" you can also print original value by using "%c".

Complete ASCII value Table

#include <stdio.h>
#include <conio.h>
void main()
{
    int chr;
    
    printf("Enter a character range(0-255): ");
    
	scanf("%d",&chr);       
    
	printf("ASCII value of %d = %c",chr,chr);
    
	getch();
}

Download ASCII value Table

In the above example, you can print from 0 to 255 character ASCII value.

See Also

Php tutorial introduction   |   Php foreach loop   |   About us

QUOTES OF THE DAY

Saying is one thing, and doing is another.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER