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

打印形状

时间:2018-04-07 22:51:53      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:can   scan   根据   max   输出   pos   div   color   amp   

编写程序,使之能根据N的值(0-20),输出以下图形:

     *****
    *****
   *****
  *****
 *****

 1 #include<stdio.h>
 2 #define MAX 20
 3 int main(){
 4     int i,j,n;
 5     printf("Enter(0---%d)",MAX);
 6     scanf("%d",&n);
 7     for(i=1;i<=n;i++){
 8         for(j=1;j<=n-i;j++)
 9             printf(" ");
10         for(j=1;j<=n;j++)
11             printf("*");
12             printf("\n");
13     }
14     return 0;
15 }

 

打印形状

标签:can   scan   根据   max   输出   pos   div   color   amp   

原文地址:https://www.cnblogs.com/geziyu/p/8734802.html

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