Notice
Recent Posts
Recent Comments
Link
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Archives
Today
Total
관리 메뉴

Everything has an expiration date

BAEKJOON - 10430 : 나머지 본문

BAEKJOON - challenge/입출력과 사칙연산

BAEKJOON - 10430 : 나머지

Jelly-fish 2023. 9. 17. 10:25

import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		// 1. 변수 선언
		Scanner sc = new Scanner(System.in);
		int a, b, c;
		
		// 2. 사용자로부터 세 개의 정수를 입력받기.
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		
		
		// 3. 첫째 줄에 (A+B)%C,
		//    둘째 줄에 ((A%C) + (B%C))%C,
		//    셋째 줄에 (A×B)%C,
		//    넷째 줄에 ((A%C) × (B%C))%C를 출력한다.
		
		System.out.println((a + b) % c);
		System.out.println(((a % c) + (b % c)) % c);
		System.out.println((a * b) % c);
		System.out.println(((a % c) * (b % c)) % c);
	}

}

👾