U E D R , A S I H C RSS

자바민국/과제 (rev. 1.2)

자바민국/과제



1. 1회차

* 과제 : 맥주 99병 문제 풀기

1.1. 박인서

여기에 코드를 입력해주세요.

1.2. 송정우

여기에 코드를 입력해주세요.

1.3. 이승찬

여기에 코드를 입력해주세요.

1.4. 정우현

여기에 코드를 입력해주세요.

1.5. 이호민

import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n;
        n=sc.nextInt();
        for(int i=n; i>0;){
            System.out.printf(i + " bottle" + (i==1?"":"s") + " of beer on the wall, " + i + " bottle" + (i--==1?"":"s") + " of beer.\n");
            if(i==0) System.out.printf("Take one down and pass it around, no more bottles of beer on the wall.\n\n");
            else System.out.printf("Take one down and pass it around, " + i + " bottle" + (i==1?"":"s") + " of beer on the wall.\n\n");
        }
        System.out.printf("No more bottles of beer on the wall, no more bottles of beer.\n" +
                "Go to the store and buy some more, " + n + " bottle" + (n==1?"":"s") + " of beer on the wall.");
    }
}

1.6. 김유현

여기에 코드를 입력해주세요.

1.7. 좌민주

여기에 코드를 입력해주세요.
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-16 14:07:57
Processing time 0.0246 sec