-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresume.java
More file actions
44 lines (37 loc) · 1.07 KB
/
Copy pathresume.java
File metadata and controls
44 lines (37 loc) · 1.07 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package quiz;
import java.util.Scanner;
public class resume {
public static void main(String[] args) {
int total = 0;
int count = 0;
int price = 0;
int n = 0;
int result = 0;
int multi = 0;
Scanner scanner = new Scanner(System.in);
System.out.println("총 구입액을 입력");
total = scanner.nextInt();
System.out.println("구입한 물품의 종류 입력");
n = scanner.nextInt();
// for(int i = 1; i <= n; i++) {
// System.out.println("구입한 물품의 가격 입력");
// price = scanner.nextInt();
// System.out.println("구입한 물품의 갯수 입력");
// count = scanner.nextInt();
// multi = price * count;
// result += multi;
// }
// System.out.println(total == result);
int a = 0;
while(a < n) {
System.out.println("구입한 물품의 가격 입력");
price = scanner.nextInt();
System.out.println("구입한 물품의 갯수 입력");
count = scanner.nextInt();
multi = price * count;
result += multi;
a ++;
}
System.out.println(total == result);
}
}