HTML & JS
#include<bits/stdc++.h>
using namespace std;

int main(){
	
		int n;
		cin>>n;

		for(int i=1;i<=n;i++){
			int ch = i;
			for(int j=1;j<=n-i;j++){
				cout<<" ";
			}
			for(int k=1;k<=i;k++){
				cout<<ch<<" ";
			}
			cout<<endl;
		}
	
}

Generated URL:

Output:

     1 
    2 2 
   3 3 3 
  4 4 4 4 
 5 5 5 5 5 
6 6 6 6 6 6 
Report Bug