Asking for code

if i input 5, then the output will be

11 12 13 14 15
12 13 14 15
13 14 15
14 15
15

if i input 4, then the output

12 13 14 15
13 14 15
14 15
15

if i input 3, then

13 14 15
14 15
15

what is the code?
what is the code?
What have you tried?

Do you know how to print
10 10 10 10
10 10 10
10 10
10

Do you know how to print
12 13 14 15

http://www.cplusplus.com/doc/tutorial/control/
Hint: for loops
Last edited on
#include <iostream>
using namespace std;

main(){
int n, akhir=15, nil;
cout<<"Masukkan Bilangan : "; cin>>n;
for(int i=n; i>=1; i--){
for(int j=i; j>0; j--){
nil = akhir - j+1;
cout<<nil<<" ";
}
cout<<endl;
}
}

i found it, thanks
Last edited on
Topic archived. No new replies allowed.