View Code of Problem 2592

#include <bits/stdc++.h>
#define N 1000
using namespace std;
int main() 
{	
	int t;
	cin>>t;
	while(t--)
	{
		int n,i,j;
		char ch;
		cin>>ch>>n;
		for(i=0;i<n-1;i++)
		{
			for(j=n-i-2;j>=0;j--)
				cout<<" ";
			cout<<ch;
			for(j=1;j<2*i;j++)
			{
				cout<<" ";
					
			}
			if(i!=0)
				cout<<ch;
			cout<<endl;
		}
		for(i=0;i<2*n-1;i++)
			cout<<ch;
		cout<<endl;
	}	
}

Double click to view unformatted code.


Back to problem 2592