Skip to content

Commit 813bfa0

Browse files
Merge pull request #4 from shivam7092/main
Characters from A to Z Using Loop in c
2 parents 091049a + dadcc5a commit 813bfa0

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <stdio.h>
2+
int main() {
3+
char c;
4+
printf("Enter u to display uppercase alphabets.\n");
5+
printf("Enter l to display lowercase alphabets. \n");
6+
scanf("%c", &c);
7+
8+
if (c == 'U' || c == 'u') {
9+
for (c = 'A'; c <= 'Z'; ++c)
10+
printf("%c ", c);
11+
} else if (c == 'L' || c == 'l') {
12+
for (c = 'a'; c <= 'z'; ++c)
13+
printf("%c ", c);
14+
} else {
15+
printf("Error! You entered an invalid character.");
16+
}
17+
18+
return 0;
19+
}
20+
21+
22+
23+
// Output
24+
25+
// Enter u to display uppercase alphabets.
26+
// Enter l to display lowercase alphabets. l
27+
// 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

0 commit comments

Comments
 (0)