Can someone tell me to program for genrate this series | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone tell me to program for genrate this series

Write a program to generate this series 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 6 5 4 3 2 1

26th Mar 2020, 5:54 PM
Niteesh Mourya
Niteesh Mourya - avatar
2 Answers
+ 7
#include <iostream> using namespace std; int main() { int n; cin>>n; for(int i=1;i<=n;i++){ for (int j=i;j>0;j--){ cout<<j<<" "; } cout<<"\n"; } return 0; }
26th Mar 2020, 6:04 PM
Cmurio
Cmurio - avatar
+ 1
give a try first! if any query occurs then post that code here and ask for help https://www.sololearn.com/Discuss/1316935/?ref=app
26th Mar 2020, 5:59 PM
John Robotane
John Robotane - avatar