首页 > 编程语言 > 详细

算法训练 图形显示

时间:2016-03-27 19:31:57      阅读:292      评论:0      收藏:0      [点我收藏+]
  算法训练 图形显示  
时间限制:1.0s   内存限制:512.0MB
    
问题描述
  编写一个程序,首先输入一个整数,例如5,然后在屏幕上显示如下的图形(5表示行数):
  * * * * *
  * * * *
  * * *
  * *
  *
 
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        for(int i=n;i>=1;i--){
            for(int j=1;j<=i;j++){
                System.out.print("* ");
            }
            System.out.println();
        }

    }

}

 

算法训练 图形显示

原文:http://www.cnblogs.com/watchfree/p/5326379.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!