-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlottery.java
More file actions
39 lines (35 loc) · 832 Bytes
/
lottery.java
File metadata and controls
39 lines (35 loc) · 832 Bytes
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
import java.util.*;
public class lottery {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a = 0, cnt = 0;
if (n >= 100) {
a = n / 100;
n = n % 100;
cnt = cnt + a;
}
if (n >= 20) {
a = n / 20;
n = n % 20;
cnt = cnt + a;
}
if (n >= 10) {
a = n / 10;
n = n % 10;
cnt = cnt + a;
}
if (n >= 5) {
a = n / 5;
n = n % 5;
cnt = cnt + a;
}
if (n >= 1) {
a = n / 1;
n = n % 1;
cnt = cnt + a;
}
System.out.println(cnt);
sc.close();
}
}