Number Pattern 1 in C++

 Number Pattern 1

Send Feedback

Pattern for N = 4

1
23
345
4567
Input Format :
N (Total no. of rows)
Output Format :
Pattern in N lines
Sample Input 1 :
3
Sample Output 1 :
1
23
345

#include<iostream>
using namespace std;


int main(){
int row=1;
int n;
cin>>n;
while(n>=row){
int col=1;
int copy=row;
while(row>=col){
cout<<copy;
copy++;
col++;
}
cout<<endl;
row++;
}
}

Comments

Popular posts from this blog

Code : All connected components

Coding Ninjas