import java.util.Scanner;


public class Calender_Scanner {


public static void main(String[] args) {

// TODO Auto-generated method stub


int[][] arr = new int[12][31];

int i = 0;

int j = 0;

while(i<12) {

if(i+1 == 1 || i+1 == 3 || i+1 == 5 || i+1 == 7 || i+1 == 8 || i+1 == 10 || i+1 == 12) {

j = 0;

while(j<31) {

arr[i][j] = j+1;

j++;

}

}

else if(i+1 == 4 || i+1 == 6 || i+1 == 9 || i+1 == 11) {

j = 0;

while(j<30) {

arr[i][j] = j+1;

j++;

}

}

else{

j = 0;

while(j<28) {

arr[i][j] = j+1;

j++;

}}//end if

i++;

}//end while

i = 0;

System.out.println("알고싶은 월을 입력하세요");

Scanner a = new Scanner(System.in);

int c;

c = a.nextInt();

if( c == 1 || c == 3 || c == 5 || c == 7 || c == 8 || c == 10 || c == 12 ) {

System.out.println(c +" 월 " );

System.out.println("월\t" + "화\t" + "수\t" + "목\t" + "금\t"+"토\t"+"일\t");

j = 0;

while(j<31) {

arr[c-1][j] = j+1;

System.out.print(arr[c-1][j]);

System.out.print('\t');

if((j+1)%7 == 0) {

System.out.println();

}

j++;

}

}

else if(c == 4 || c == 6 || c == 9 || c == 11) {

System.out.println(c +" 월 " );

System.out.println("월\t" + "화\t" + "수\t" + "목\t" + "금\t"+"토\t"+"일\t");

j = 0;

while(j<30) {

arr[c-1][j] = j+1;

System.out.print(arr[c-1][j]);

System.out.print('\t');

if((j+1)%7 == 0) {

System.out.println();

}

j++;

}

}

else{

System.out.println(c +" 월 " );

System.out.println("월\t" + "화\t" + "수\t" + "목\t" + "금\t"+"토\t"+"일\t");

j = 0;

while(j<28) {

arr[c-1][j] = j+1;

System.out.print(arr[c-1][j]);

System.out.print('\t');

if((j+1)%7 == 0) {

System.out.println();

}


j++;

}


}

 

}

}



블로그 이미지

irostub

iro의 잡화상점

,