Number pattern |
Print the following pattern for the given N number of rows.
Pattern for N = 41234
123
12
1
Input format :
Integer N (Total no. of rows)
Output format :
Pattern in N lines
Sample Input :
5
Sample Output :
12345
1234
123
12
1
C++ Code :-
#include<iostream>
using namespace std;
int main()
{
int N;
cin >> N;
for(int i = N; i >= 1; --i )
{
for(int j = 1; j <= i; ++j)
{
cout << j ;
}
cout<<endl;
}
}
.
ReplyDelete