Number Pattern
Print the following pattern for the given N number of rows for N = 4
1234
123
12
1
C/C++,java,python c++ keywords, identifiers, data types,variables,modifiers,storage classes,operators,for loop ,while loop,do while loop,if else statement,nested loops,break continue goto statement,functions ,call by value call by reference ,arrays ,strings,pointers,data structures ,classes and objects,inheritance,polymorphism,operator overloading,function overloading,data abstraction,data encapsulation,dynamic memory allocation for array and objects,function templates,class templates,
Number Pattern
Print the following pattern for the given N number of rows for N = 4
1234
123
12
1
Integer N (Total no. of rows)
Pattern in N lines
5
12345
1234
123
12
1
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;
}
}
0 comments:
Post a Comment