-->

program to print/display all ascii values of letters from A to Z and a to z..

//program  to print/display all ascii values of letters from A to Z and a to z..

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char k='A';
while(k<='Z')
{
printf("chracter=%c and ascii value=%d | \t character=%c and ascii value=%d\n",k,k,k+32,k+32);
k++;
}
getch();
}

note:
logic applied:
we have printed character and its asciii value.
ASCII value of 'A' is 65 and 'a' is 97.
We can see difference of both is 32 so we can get ascii value by adding 32 to respective values and charcaters.

No comments:

Post a Comment