http://lx.lanqiao.org/problem.page?gpid=T247

算法训练 图形显示  
时间限制:1.0s   内存限制:512.0MB
    
问题描述
  编写一个程序,首先输入一个整数,例如5,然后在屏幕上显示如下的图形(5表示行数):
  * * * * *
  * * * *
  * * *
  * *
  *
 
分析:
 
一个字,送分题。
 
AC代码:
 
 1 #include <stdio.h>
 2 int main()
 3 {
 4     int i , j , n;
 5     while(scanf("%d",&n)!=EOF)
 6     {
 7         for(i = 1 ;i <= n;i ++)
 8         {
 9             for(j = 1; i + j < n + 1; j ++)
10                 printf("* ");
11             puts("*");
12         }
13     }
14     return 0;
15 }
View Code

 

相关文章:

  • 2021-05-03
  • 2021-05-29
  • 2021-09-07
  • 2021-06-01
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-23
  • 2021-08-27
  • 2021-11-02
  • 2021-12-17
相关资源
相似解决方案