输入样例:1
输出样例:
*
输入样例:5
输出样例:
*
***
*****
*******
*********
*******
*****
***
*
#include <stdio.h>int main(){ int n;scanf("%d",&n);int i,j,k;for(i=1;i<=n;i++){for(k=i;k<n;k++){printf(" ");}for(j=1;j<=2*i-1;j++){printf("*");}printf("\n");} for(i=1;i<n;i++){for(k=1;k<=i;k++){printf(" ");}for(j=1;j<=2*(n-i)-1;j++){printf("*");}printf("\n");}return 0;}