+ 1

Anybody please help me understanding this code in C:

#include<stdio.h> void main() {     int i,j;     printf(“\n Alphabetical Pattern\n\n”);     for(i=’A’;i<=’Z’;i++)     {         for(j=’A’;j<=i;j++)         {             printf(“ %c ”,j);         }         printf(“\n”);     } }

9th Apr 2017, 3:02 PM
Avrl Sngh
Avrl Sngh - avatar
1 Answer
+ 1
the following code will produce:- Alphabetical Pattern A AB ABC ABCD . like this till A-Z the main code of this program lies in 2 for loops 1. will go from A to Z 2. will go from A to 1st loop's var. followed by a new line "\n" line printf(" %c ",j); will print the value of "j" which is a character type. thus %c is a format specifier to print a character. in C printf() is use to print something on screen, like cout in C++. hope it would help!
9th Apr 2017, 3:30 PM
GeekyShacklebolt - avatar