백준 10869번
2020. 4. 25. 16:48ㆍ자료구조와 알고리즘
문제
두 자연수 A와 B가 주어진다. 이때, A+B, A-B, A*B, A/B(몫), A%B(나머지)를 출력하는 프로그램을 작성하시오.
출력
import java.util.Scanner;
public class al10869 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
sc.close();
System.out.println(A + B);
System.out.println(A - B);
System.out.println(A * B);
System.out.println(A / B);
System.out.println(A % B);
}
}
스캐너 사용.
'자료구조와 알고리즘' 카테고리의 다른 글
백준 14681번 사분면 고르기 (0) | 2020.04.26 |
---|---|
백준 2753번 윤년 (0) | 2020.04.26 |
백준 9498번 시험 성적 (0) | 2020.04.25 |
백준 1330번 두 수 비교하기 (0) | 2020.04.25 |
백준 10430번 (0) | 2020.04.25 |