ASCII Value

ASCII stands for American Standard Code of Information Interchange. There are 256 (0 to 255) distinct characters and each character has its own value known as ASCII value. With the help of ASCII value characters can be easily converted into binary code which is understandable by c compiler.

Character type Range No. of characters ASCII value
Capital Letters A to Z 26 65 to 90
Small Letters a to z 26 97 to 122
Digits 0 to 9 10 48 to 57
Special Symbols 66 0-47, 58-64, 91-96, 123-127
Graphics Character 128 128 to 256
Total 256

Exercise Questions: ASCII Value

  1. WAP to Print ASCII Value of input character.
  2. void main()
    {
        char ch;
        clrscr();
        printf("Enter character");
        ch = getche();
        printf("\nASCII Value of %c id %d",ch, ch);
        getch();
    }
  3. Print all characters with its ASCII value from 0 to 255
  4. void main()
    {
        int i;
        clrscr();
        for(i=0;i<=255;i++)
        {
            printf("\nASCII value of Character %c is %d",i,i);
        }
        getch();
    }
  5. sum the ascii value of a string.
  6. void main()
    {
        char name[50];
    	int i=0, sum=0;
        clrscr();
        printf("Enter name: ");
        scanf("%s", name);  
        while(name[i]!='\0')
        {  
            printf("\nThe ascii value of the character %c is %d", name[i],name[i]);  
            sum=sum+name[i];  
            i++;  
        }  
        printf("\nSum of the ascii value of a string is : %d", sum);  
        getch();
    }