백준

업데이트:

2753번 : 윤년 (JAVA)

[입력] 첫째 줄에 연도가 주어진다. 연도는 1보다 크거나 같고, 4000보다 작거나 같은 자연수이다.
[출력] 첫째 줄에 윤년이면 1, 아니면 0을 출력한다.

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int year = sc.nextInt();
			
		if (year>=1 && year<=4000) { 
			if((year % 4 ==0 && year % 100 != 0) ||year % 400 ==0 ) {
				System.out.print("1");
			} else {
				System.out.print("0");
			}
		}
	}
}
}




9498번 : 시험 성적 (JAVA)

[입력] 시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, 나머지 점수는 F를 출력하는 프로그램을 작성하시오.
[출력] 첫째 줄에 시험 점수가 주어진다. 시험 점수는 0보다 크거나 같고, 100보다 작거나 같은 정수이다.

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int score = sc.nextInt();
			if (score>=0 && score<=100) { 
				if(score>=90) {
					System.out.println("A");
					}else if (score>=80) {
						System.out.println("B");
					}else if(score>=70){
						System.out.println("C");
					}else if (score>=60) {
						System.out.println("D");
					}else {
						System.out.println("F");
					}
				}
			}
}


댓글남기기