In this example, you will learn to print all the letters of the English alphabet.
#include <stdio.h>
int main() {
char c;
for (c = 'A'; c <= 'Z'; ++c)
printf("%c ", c);
return 0;
}
Output :
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
#include <stdio.h>
int main() {
char c;
for (c = 'a'; c <= 'z'; ++c)
printf("%c ", c);
return 0;
}
Output :
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
#include <stdio.h>
int main() {
char c;
printf("Enter U to display uppercase alphabets.\n");
printf("Enter L to display lowercase alphabets. \n");
printf("Enter Your Choice :: ");
scanf("%c", &c);
if (c == 'U' || c == 'u') {
for (c = 'A'; c <= 'Z'; ++c)
printf("%c ", c);
} else if (c == 'L' || c == 'l') {
for (c = 'a'; c <= 'z'; ++c)
printf("%c ", c);
} else {
printf("Error! You entered an invalid character.");
}
return 0;
}
Output :
Enter U to display uppercase alphabets.
Enter L to display lowercase alphabets.
Enter Your Choice :: U
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
Ask anything about this examples