Write a C program to print the following character number pyramid as: 1 A B 2 3 4 C D E F | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write a C program to print the following character number pyramid as: 1 A B 2 3 4 C D E F

9th Jun 2018, 10:10 PM
Anas El messlati
Anas El messlati - avatar
5 Answers
+ 8
Here It is ๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡ https://code.sololearn.com/cdNCyW49MeNC/?ref=app
9th Jun 2018, 10:32 PM
Mohammad Amir Aqeel
Mohammad Amir Aqeel - avatar
+ 8
Anas El messlati I stopped the loop at ch=G and i=9 if you want you can continue further.
9th Jun 2018, 10:35 PM
Mohammad Amir Aqeel
Mohammad Amir Aqeel - avatar
+ 8
Anas El messlati My Pleasure!!!๐Ÿ˜Š๐Ÿ˜Š
9th Jun 2018, 11:12 PM
Mohammad Amir Aqeel
Mohammad Amir Aqeel - avatar
+ 2
Just a little different approach in C #include <stdio.h> int main() { const char* fmt = "%c "; char ca = 'A', cn = '1'; for(int row = 0; row < 6; ++row) { for(int col = 0; col <= row; ++col) { if(row & 1) // even rows printf(fmt, ca++); else // odd rows printf(fmt, cn++); } printf("\n"); } return 0; }
10th Jun 2018, 12:34 AM
Ipang
+ 1
Thanks Mohammed amir aqeel
9th Jun 2018, 10:46 PM
Anas El messlati
Anas El messlati - avatar