View Code of Problem 2592

#include <iostream>
using namespace std;

int main() {
	int t;
	cin >>t;
	while(t--){
		char a;
		int x;
		cin >>a>>x;
		for(int i=0;i<x-1;i++){
			for(int j=x-i-1;j>0;j--){
				cout <<" ";
			}
			cout <<a;
			for(int k=0;k<(2*i-1);k++){
				cout <<" ";
			}
			if(i!=0)
				cout <<a;
			/*
			for(int l=x-i-1;l>0;l--){
				cout <<" ";
			}
			*/
			cout <<endl;
		}
		for(int m=0;m<(2*x-1);m++){
			cout <<a;
		}
		cout <<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 2592