C program to print alphabets from a to z using while loop and for loop with char data type as well as int data type.
#include <stdio.h>
void main()
{
char ch;
printf("Alphabets from a - z\n");
for (ch = 'a'; ch <= 'z'; ch++)
printf("%c\n", ch);
}
#include <stdio.h>
void main()
{
int i;
printf("Alphabets from a - z\n");
for (i = 97; i <= 122; i++)
printf("%c\n", i);
}
#include <stdio.h>
void main()
{
char ch = 'a';
printf("Alphabets from a - z\n");
while (ch <= 'z')
{
printf("%c\n", ch);
ch++;
}
}
#include <stdio.h>
void main()
{
char i = 97;
printf("Alphabets from a - z\n");
while (i <= 122)
{
printf("%c\n", i);
i++;
}
}
Output
Alphabets from a - z a b c d e f g h i j k l m n o p q r s t u v w x y z