绘制平行四边形

package exercise;

import java.util.Arrays;
import java.util.Scanner;

public class Exe3_Painting {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner input = new Scanner(System.in);
        System.out.println("请输入行数");
        int num = input.nextInt();
        if(num < 0){
            System.out.println("行数无效,操作结束");
            return;
        }
        else{
            //绘制行数
            for(int i = num; i > 0 ; i--){
                /*String[] Space = new String[i-1];
                Arrays.fill(Space, " ");
                System.out.print(Arrays.toString(Space));*/
                //绘制空格
                for( int j = 0 ; j < i-1 ;j++){
                    System.out.print(" ");
                }
                //绘制@
                for (int k = 0; k < 10 ; k++){
                    System.out.print('@');
                }
                System.out.println();
            }
        }
        input.close();
    }

}

 

posted @ 2016-07-30 19:42  me丶不是好人  阅读(246)  评论(0编辑  收藏  举报