Could any one develop the pattern of the following c ++program?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Could any one develop the pattern of the following c ++program??

****1 ***21 **321 *4321 54321 ... Using for loop only...!

22nd Jul 2020, 3:49 PM
M Rishi
6 Answers
+ 1
Where is your attempt ?
22nd Jul 2020, 3:53 PM
Arsenic
Arsenic - avatar
+ 1
#include<iostream> using namespace std; int main() { int out; for(out=5;out>=1;out--) { int in; for(in=1;in<out;in++) { cout <<" "; } int a; for(a=5;a>=out;a--) { cout <<a; } cout <<"\n"; } return 0; }
22nd Jul 2020, 3:55 PM
M Rishi
+ 1
M Rishi it's working perfectly. Then what's the problem??
22nd Jul 2020, 3:57 PM
Arsenic
Arsenic - avatar
+ 1
But output is not same as the above sir
22nd Jul 2020, 3:58 PM
M Rishi
22nd Jul 2020, 4:07 PM
Arsenic
Arsenic - avatar
+ 1
Thank u so much sir.. 👍
22nd Jul 2020, 5:00 PM
M Rishi