50-Write a program to print a to z or A to Z by user choice.

Program: 50

Write a program to print a to z or A to Z by user choice.

#include 
#include 
void main()
{
    char c;
    printf("Enter u to display alphabets in uppercase. And enter l to display alphabets in lowercase: ");
    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 invalid character.");
   getch();

}
Output
Enter u to display alphabets in uppercase. And enter l to display alphabets in lowercase: 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

Lokesh Kumar: Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.
Related Post
Leave a Comment

This website uses cookies.