码迷,mamicode.com
首页 > 其他好文 > 详细

排版题

时间:2018-01-13 18:59:30      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:http   .com   col   can   ret   clu   while   技术分享   排版   

技术分享图片

技术分享图片

代码:

#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;
} 

 

排版题

标签:http   .com   col   can   ret   clu   while   技术分享   排版   

原文地址:https://www.cnblogs.com/chao-zjj/p/8279320.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!