본문 바로가기
Algorithm

[Java] 백준 10430번: 나머지

by sukii 2023. 11. 16.
반응형

10926번 문제

 

이건 식이 문제에 다 나와있어서 복붙하면 되는 문제였다 ㅇㅅㅇ!

그치만 [ x ] 이건 쓸 수 없으니 [ * ]로 바꿔주기만 하면 된다.

 

최종 정답👩‍💻

 

import java.util.Scanner;

public class Main{
    public static void main (String[] args){
        Scanner sc = new Scanner(System.in);
        int A =sc.nextInt();
        int B =sc.nextInt();
        int C =sc.nextInt();
        
        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);
        
        sc.close();
    }
}
반응형