View Code of Problem 2592

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	int t,i,j;
	scanf("%d",&t);
	getchar();
	while(t--)
	{
		char ch;
		int n;
		scanf("%c %d",&ch,&n);
		for(i=1;i<=n-1;i++) printf(" ");
		printf("%c\n",ch);
			for(i=2;i<n;i++)
			{
				for(j=1;j<=n-i;j++)
				printf(" ");
				printf("%c",ch);
				for(j=1;j<=2*(i-1)-1;j++)
				printf(" ");
				printf("%c\n",ch); 
			}
		for(i=1;i<=2*n-1;i++)
		printf("%c",ch);
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 2592