Easy Tutorial
❮ C Standard Library Assert H C Function Snprintf ❯

C Language Example - Loop Output of 26 Letters

C Language Examples

Loop output of 26 letters.

Example

#include <stdio.h>

int main()
{
    char c;

    for(c = 'A'; c <= 'Z'; ++c)
       printf("%c ", c);

    return 0;
}

Execution Result:

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

Example - Output Uppercase or Lowercase Letters

#include <stdio.h>

int main()
{
    char c;

    printf("Enter u to display uppercase letters, enter l to display lowercase letters: ");
    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! Invalid character input.");
    return 0;
}

Execution Result:

Enter u to display uppercase letters, enter l to display lowercase letters: l
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

C Language Examples

❮ C Standard Library Assert H C Function Snprintf ❯