View Code of Problem 2592

#include<stdio.h>
#include<stdlib.h>

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		char f;
		int n;
		getchar();
		scanf("%c %d",&f,&n);
		for(int i=1; i<=n ;i++){
			int j=n-i,k;
			while(j>0){
				printf(" ");
				j--;
			}
			printf("%c",f);
			if(i!=1 && i!=n){
				for(k=1; k<i*2-2; k++)
					printf(" ");
				printf("%c",f);
			}
			if(i==n){
				for(k=1; k<2*i-1; k++)
					printf("%c",f);
			}
			printf("\n");
			
		}
	
	
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 2592