0

Write a for loop code in c++ language whose output is :

5 5 4 5 4 3 5 4 3 2 5 4 3 2 1 9 7 9 5 7 9 3 5 7 9 1 3 5 7 9

7th Nov 2018, 2:41 AM
Deviprasad Sahu
Deviprasad Sahu - avatar
2 odpowiedzi
+ 1
https://code.sololearn.com/cq78lBOH5O32/?ref=app It's it, sorry I did it in c before
7th Nov 2018, 3:12 AM
Gaurav Atreya
Gaurav Atreya - avatar
0
One for loop or two for loops? int i,j; for(i=5;i>0;i--) { for(j=5;j>=i;j--) { printf("%d",j); } printf("\n"); } for(i=9;i>0;i-=2) { for(j=i;j<=9;j+=2) { printf("%d",j); } printf("\n"); }
7th Nov 2018, 3:06 AM
Gaurav Atreya
Gaurav Atreya - avatar