This repository was archived by the owner on Dec 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathURI_1018.java
More file actions
46 lines (38 loc) · 1.29 KB
/
Copy pathURI_1018.java
File metadata and controls
46 lines (38 loc) · 1.29 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
45
46
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
int A;
int umReal;
int doisReais;
int cincoReais;
int dezReais;
int vinteReais;
int cinquentaReais;
int cemReais;
int troco;
Scanner sc = new Scanner(System.in);
A = sc.nextInt();
cemReais = A / 100;
troco = A % 100;
cinquentaReais = troco / 50;
troco = troco % 50;
vinteReais = troco / 20;
troco = troco % 20;
dezReais = troco / 10;
troco = troco % 10;
cincoReais = troco / 5;
troco = troco % 5;
doisReais = troco / 2;
troco = troco % 2;
umReal = troco;
System.out.println(A);
System.out.println(cemReais + " nota(s) de R$ 100,00");
System.out.println(cinquentaReais + " nota(s) de R$ 50,00");
System.out.println(vinteReais + " nota(s) de R$ 20,00");
System.out.println(dezReais + " nota(s) de R$ 10,00");
System.out.println(cincoReais + " nota(s) de R$ 5,00");
System.out.println(doisReais + " nota(s) de R$ 2,00");
System.out.println(umReal + " nota(s) de R$ 1,00");
}
}