排版题

代码:

#include <stdio.h>
int main(){
    int h;
    while( scanf("%d",&h) != EOF){
        int maxNum= h+(h-1)*2;
        for(int i=1;i<=h;i++){
            for(int j=1;j<=maxNum;j++){
                if(j<=maxNum-( h+(i-1)*2 )) printf(" ");
                else printf("*");
            }
            printf("\n");
        } 
    } 
    return 0;
} 

 

posted @ 2018-01-13 16:03  思丿无邪  阅读(66)  评论(0编辑  收藏  举报