Network disconnected
Description
주석의 지시에 따라 코드를 완성해보세요.
- 변수 c에는 변수 a와 b의 합을 저장
- 변수 d에는 변수 a에 b를 뺀 값을 저장
- 변수 e에는 변수 a와 b의 곱을 저장
- 변수 f에는 a를 b로 나눈 나머지를 저장
힌트: 아래의 예를 참고하여 2개의 변수를 이용한 산술 연산에 대해 알아보세요.
// i와 j의 합
i + j;
// i와 j의 차
i - j;
// i와 j의 곱
i * j;
// i를 j로 나눈 몫
i / j;
// i를 j로 나눈 나머지
i % j;
Question type: Fill in the blank
- You need to fill in the blank with the appropriate code.
- You cannot modify the given code.
- An error message will appear in the result if you leave the blank empty.
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
public class OperatorExam {
public int[] calculate() {
int a = 7;
int b = 3;
//c는 a와 b의 합
int c =
//d는 a와 b의 차
int d =
//e는 a와 b의 곱
int e =
//f는 a를 b로 나눈 나머지
int f =
System.out.printf("c는: %d\n", c);
System.out.printf("d는: %d\n", d);
System.out.printf("e는: %d\n", e);
System.out.printf("f는: %d\n", f);
int ret[] = {c, d, e, f};
return ret;
}
public static void main(String []args){
new OperatorExam().calculate();
}
}
Result
Stop
Result of [Run Test] or [Submit] will be displayed here
내가 제출한 코드가 왜 틀렸는지 프로그래머스 AI에게 물어보세요.
제출 후 채점하기를 눌러 30점 이상인 경우 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.