Contact Learn C
Copy

Program 4:Print Alphabets from a-z(small)

Program:

#include<stdio.h>
main()
{
int i;
for(i=97;i<=122;i++)
{
printf("%c",i);
}
printf("\n");
}
Explanation:
  1. Here we declared an integer i.
  2. Now this program is same as printing numbers from 97 to 122.
  3. But if you can remember the "ASCII" values of 97 which resembles 'a' and 122 which resembles 'z' as in ascii sheet. To refer ASCII Values click here.
  4. So instead of "%d" if we use "%c" it is converted to ascii value.
Output: 

Print Alphabets from a-z(small)
 
Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide