In this example, we use two for loops in conjunction with the putchar library function to print all uppercase letters followed by all lowercase letters. The loop variable ch is assumed to be of type char or int. The first for loop prints the uppercase letters as loop variable ch assumes values as ‘A’, 'B’, ... , ‘z’.
Then a put char function prints a newline character to move the cursor to the next line on which the second for loop prints the lowercase letters. Note that the same loop variable is used for both for loops. The output is given below.
printf("Print all uppercase letters followed by all lowercase letters on the next line :\n");
/* print uppercase letters */
for (ch= 'A'; ch<= 'Z'; ch++)
putchar ('\n' ) ;
/* print lowercase letters */
for (ch= 'a'; ch<= 'z'; ch++)
putchar ('\n') ;