Search This Blog


Wednesday, 24 April 2019

Program to Print Alphabets from A to Z Using Loop

Welcome back coders , here is our new blog on PROGRAM TO PRINT ALPHABETS FROM A TO Z USING LOOP. 



In the below program, for loop is used to print the alphabets from A to Z. A loop variable is taken to do this of type ‘char’. The loop variable ‘i’ is initialized with the first alphabet ‘A’ and incremented by 1 on every iteration. In the loop, this character ‘i’ is printed as the alphabet.

CODE

#include <stdio.h>
  
int main()
{
    // Declare the variables
    char i;
  
    // Display the alphabets
    printf("The Alphabets from A to Z are: \n");
  
    // Traverse each character
    // with the help of for loop
    for (i = 'A'; i <= 'Z'; i++) {
  
        // Print the alphabet
        printf("%c ", i);
    }
  
    return 0;
}


 

OUTPUT


No comments:

Post a Comment