triangle number pattern

Solutions on MaxInterview for triangle number pattern by the best coders in the world

showing results for - "triangle number pattern"
Fátima
21 Apr 2020
1#include<bits/stdc++.h>
2using namespace std;
3int main()
4{
5	int n;
6	cin>>n;
7	for(int i=1;i<=n;i++)
8	{
9		for(int j=1;j<=n-i;j++)
10		{
11			cout<<" ";
12		}
13		for(int j=1;j<=i;j++)
14		{
15			cout<<j<<" ";
16		}
17		cout<<endl;
18	}
19	return 0;			
20}