The Artima Developer Community
Sponsored Link

Java Buzz Forum
C program to display characters from a to z using loop

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
instanceof java

Posts: 576
Nickname: instanceof
Registered: Jan, 2015

instanceof java is a java related one.
C program to display characters from a to z using loop Posted: May 20, 2017 5:21 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by instanceof java.
Original Post: C program to display characters from a to z using loop
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java

Advertisement
  • C program to display characters from a to z using loop.
  • We can print all alphabets starting from A to Z using for loop.
  • Take a char variable and using for loop iterate it from A to Z.
  • Let us see an Example C program to print A to Z using for loop.



Program #1: Write a C program to print or display characters from A to Z using for loop.

  1. #include <stdio.h>
  2. int main()
  3. {
  4.     char c;
  5.  
  6.     for(c = 'A'; c <= 'Z'; ++c)
  7.       printf("%c ", c);
  8.     
  9.     return 0;
  10. }

   Output:

  1. 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

Program #2: Write a C Program to Display English Alphabets in Uppercase and Lowercase

  1. #include <stdio.h>
  2. int main()
  3. {
  4.      char c;
  5.  
  6.     printf("Enter u to display alphabets in uppercase. And enter l to display alphabets in
  7. lowercase: ");
  8.     scanf("%c", &c);
  9.  
  10.     if(c== 'U' || c== 'u')
  11.     {
  12.        for(c = 'A'; c <= 'Z'; ++c)
  13.          printf("%c ", c);
  14.     }
  15.     else if (c == 'L' || c == 'l')
  16.     {
  17.         for(c = 'a'; c <= 'z'; ++c)
  18.          printf("%c ", c);
  19.     }
  20.     else
  21.        printf("Error! You entered invalid character.");
  22.     getch();
  23. }
     

  Output:

print a to z c program

Read: C program to display characters from a to z using loop

Topic: Convert string to integer c programming Previous Topic   Next Topic Topic: C program to find ASCII value of a string or character

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use