Algorithm/SW Expert Academy

2029. 몫과 나머지 출력하기

히욤이 2019. 1. 10. 22:16

SW Expert 2029. 몫과 나머지 출력하기

문제의 저작권은 SW Expert에 있습니다 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.util.Scanner;
 
class Solution {
    public static void main(String args[]) {
 
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();; //TestCase 개수
        int a, b;
        for (int test_case = 0; test_case < T; test_case++) {
            int mok, nam = 0;
            a = scanner.nextInt();
            b = scanner.nextInt();
            mok = a/b; //몫 
            nam = a%b; //나머지
            
            System.out.println("#" + (test_case+1+" "+ mok +" " +nam);
        }
    }
}
cs


댓글수0