Code: Reverse Number Pattern
Code: Reverse Number Pattern
Send Feedback
Code: Reverse Number Pattern
1
21
321
4321
Integer N (Total no. of rows)
Pattern in N lines
0 <= N <= 50
5
1
21
321
4321
54321
6
1
21
321
4321
54321
654321
#include<iostream>using namespace std;
int main(){ int n; cin>>n; int row=1; while(n>=row){ int col=1; int p=row; while(row>=col){ cout<<p-col+1; col++; } cout<<endl; row++; }
/* Read input as specified in the question. * Print output as specified in the question. */ }
Comments
Post a Comment