ASCII VALUE


ASCII
fig:- ASCII

ASCII stands for American Standard Code for Information Interchange, It is the numeric value given to different characters and symbols, for computers to store and execute the program.  

Let's be clear with the following example,  


Program  


#include <stdio.h> 
#include <conio.h> 
void main() 
    char ch
    printf("enter any character to find ASCII value: "); 
    scanf("%c", &ch); 
    printf("ASCII value of %c is %d"chch); // %c to print the character 
and %d to print ASCII value of given character 
    getch(); 

  

output  

enter any character to find ASCII value: a 

ASCII value of a is 97 

enter any character to find ASCII value: A 

ASCII value of a is 65 

 

Question: write a program to enter a numeric value and fine character from a given ASCII value. 


#include <stdio.h>
#include <conio.h>
void main()
{
    int num;
    printf("enter any number to find character: ");
    scanf("%d", &num);
    printf("character value of %d is %c"numnum);
    getch();
}

 output  

 enter any number to find character: 90 

 character value of 90 is z 

  

 enter any number to find character: 100 

 the character value of 100 is d 

 

Question: print a table of ASCII value (we will discuss for loop in the coming blog) 


#include <stdio.h>
#include <conio.h>
void main()
{
    int i;
    for (i = 0i <= 250i++)
    {
        printf("ASCII value of %c is %d\n"ii); // this will print
all the character from 0-250.
    }
    getch();
}

  

output  

ASCII value of m is 109 

ASCII value of n is 110 

ASCII value of o is 113  

and etc........ 



Follow our page for regular updates.

0 Comments