-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBeeCrowd1021.java
68 lines (50 loc) · 2.45 KB
/
BeeCrowd1021.java
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import java.sql.SQLOutput;
import java.util.Scanner;
// Problem URL: https://www.beecrowd.com.br/judge/en/problems/view/1021
// Last access 12 September 2022
// Visit my GitHub repository @ https://github.com/skan90
public class BeeCrowd1021 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double monetaryAmount = input.nextFloat();
int integerValue;
System.out.println("NOTAS:");
integerValue = (int) monetaryAmount / 100;
System.out.printf("%d nota(s) de R$ 100.00\n", (integerValue));
monetaryAmount = monetaryAmount % 100.0;
integerValue = (int) monetaryAmount / 50;
System.out.printf("%d nota(s) de R$ 50.00\n", (integerValue));
monetaryAmount = monetaryAmount % 50.0;
integerValue = (int) monetaryAmount / 20;
System.out.printf("%d nota(s) de R$ 20.00\n", (integerValue));
monetaryAmount = monetaryAmount % 20.0;
integerValue = (int) monetaryAmount / 10;
System.out.printf("%d nota(s) de R$ 10.00\n", (integerValue));
monetaryAmount = monetaryAmount % 10.0;
integerValue = (int) monetaryAmount / 5;
System.out.printf("%d nota(s) de R$ 5.00\n", (integerValue));
monetaryAmount = monetaryAmount % 5.0;
integerValue = (int) monetaryAmount / 2;
System.out.printf("%d nota(s) de R$ 2.00\n", (integerValue));
monetaryAmount = monetaryAmount % 2.0;
System.out.println("MOEDAS:");
monetaryAmount = monetaryAmount * 100;
integerValue = (int) monetaryAmount / 100;
System.out.printf("%d moeda(s) de R$ 1.00\n", integerValue);
monetaryAmount = monetaryAmount % 100.0;
integerValue = (int) monetaryAmount / 50;
System.out.printf("%d moeda(s) de R$ 0.50\n", integerValue);
monetaryAmount = monetaryAmount % 50.0;
integerValue = (int) monetaryAmount / 25;
System.out.printf("%d moeda(s) de R$ 0.25\n", integerValue);
monetaryAmount = monetaryAmount % 25.0;
integerValue = (int) monetaryAmount / 10;
System.out.printf("%d moeda(s) de R$ 0.10\n", integerValue);
monetaryAmount = monetaryAmount % 10.0;
integerValue = (int) monetaryAmount / 5;
System.out.printf("%d moeda(s) de R$ 0.05\n", integerValue);
monetaryAmount = monetaryAmount % 5.0;
System.out.printf("%.0f moeda(s) de R$ 0.01\n", monetaryAmount);
input.close();
}
}