본문 바로가기

Web Dev/JAVA

자바연수) chapter4 test1

package javatry.privates.enjoy.new2015.windows.lesson.chapter06;


import java.awt.image.RasterFormatException;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;


public class list4_23 {


    public static void main(String[] args) {

        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));

        try {

            System.out.println("数値を入力しましょう。");

            do {

                String line = read.readLine();

                int n = Integer.parseInt(line);

                for (int i = 0; i <= n; i++) {

                    for (int j = n; j > i; j--) {

                        System.out.print(" ");

                    }

                    for (int j = 1; j <= (((i % 10) - 1) * 2 + 1); j++) {

                        System.out.print(i);

                    }

                    System.out.println("");

                }

                break;

            } while (true);

        } catch (IOException e) {

            System.out.println(e);

        } catch (NumberFormatException e) {

            System.out.println("数値を入力してください。数値ではありません。");

        }

    }

}


//    public static boolean check(int n) {

//        if(n==(char)n){

//            return false;

//        }

//        return true;

//            }





'Web Dev > JAVA' 카테고리의 다른 글

자바연수) chapter4 두번째문제  (0) 2015.04.21
자바연수) chapter4 마지막문제  (0) 2015.04.21
자바연수) chapter4 test2  (0) 2015.04.21
비즈리치자바연수 7장)charAt의 에러 해결  (0) 2015.04.21
자바연수) 4월16일  (0) 2015.04.17