View Code of Problem 2592

#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int t,n;
	char a;
	scanf("%d",&t);
	getchar();
	while(t--)
	{
		scanf("%c %d",&a,&n);
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n+i-1;j++)
			{
				if(j==n-i+1||j==n+i-1||i==n)
				{
					printf("%c",a);
				}
				else 
				{
					printf(" ");
				}			
			}
			printf("\n"); 
		}
		getchar();
	}
}

Double click to view unformatted code.


Back to problem 2592