Menu
×
Tutorials Ms Word Tutorial Ms Excel Tutorial Ms PowerPoint Tutorial C Language Tutorial C++ Tutorial C Sharp Tutorial Visual Basic Tutorial HTML Tutorial CSS Tutorial JavaScript Tutorial WordPress Tutorial
     ❯   

ADVERTISEMENT

Print Alphabets From A to Z

This code print Alphabets from A to Z in upper case.

#include<stdio.h>
main()
{
 int i;
 for(i=65;i<=90;i++)
 {
 printf("%c\n",i);
 }
}
C Programming Examples
OUTPUT
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 Programming Examples

Explanation:

This C program prints characters in uppercase from ‘A’ to ‘Z’ one character per line. Here’s a step-by-step explanation of the code:

Header File:

  • The program includes the standard C library header <stdio.h> for input and output operations.

Main Function:

  • The main function is the entry point of the program.

Variable Declaration:

One variable is declared:

  • i (int): It’s used as a loop counter to iterate through the character values.

Character Printing Loop:

  • The for loop is used to iterate through the character values from ‘A’ to ‘Z’. The ASCII value of ‘A’ is 65, and ‘Z’ is 90.
  • i is initialized to 65 (the ASCII value of ‘A’).
  • The loop continues as long as i is less than or equal to 90 (the ASCII value of ‘Z’).
  • In each iteration, it prints the character represented by the current value of i.

Character Printing:

  • Within the loop, printf is used to print the character represented by the ASCII value i using the format specifier %c.
  • After printing each character, it adds a newline character (\n) to move to the next line.

Character Sequence:

  • As the loop progresses, it prints characters from ‘A’ to ‘Z’ one character per line, creating a sequence of uppercase letters.

End of Program:

  • Once the loop is complete, the program reaches the end of the main function and terminates.

This code generates and displays the uppercase English alphabet characters from ‘A’ to ‘Z’, each character on a new line. The characters are printed based on their corresponding ASCII values within the specified range.

Spread the love
Scroll to Top
Scroll to Top