본문 바로가기

알고리즘/백준

[백준] 10869 - 사칙연산

반응형

10869번 문제

 

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int a, b;
        
        a = sc.nextInt();
        b = sc.nextInt();
        
        while(a <0 || b >10001){
            System.out.println("a는 1이상, b는 10000 이하로 입력해주세요!");
            
            a = sc.nextInt();
            b = sc.nextInt();
        }
        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);
        sc.close();
    }
}

 

 

반응형

'알고리즘 > 백준' 카테고리의 다른 글

[백준] 18108 - 1998년생인 내가 태국에서는 2541년생?!  (0) 2024.01.17
[백준] 10926 - ??!  (0) 2024.01.16
[백준] 1008 - A/B  (0) 2024.01.14
[백준] 10098 - A X B  (0) 2024.01.11
[백준] 1001 - A - B  (0) 2024.01.11