#include<stdio.h> int main() { char str; int n,i,j,k,t; scanf("%d",&t); while(t--) { getchar(); scanf("%c%d",&str,&n); for(j=1;j<=n-1;j++) printf(" "); printf("%c\n",str); for(i=2;i<=n-1;i++) { for(j=1;j<=n-i;j++) printf(" "); printf("%c",str); for(j=1;j<=2*i-3;j++) printf(" "); printf("%c\n",str); } if(n!=1) { for(j=1;j<=2*n-1;j++) printf("%c",str); printf("\n"); } } } |
Double click to view unformatted code.