Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.util.Scanner;
- /**
- * IMPORTANT:
- * O nome da classe deve ser "Main" para que a sua solução execute
- * Class name must be "Main" for your solution to execute
- * El nombre de la clase debe ser "Main" para que su solución ejecutar
- */
- public class Main {
- public static void main(String[] args) throws IOException {
- Scanner scanner = new Scanner(System.in);
- int i =0;
- int n = scanner.nextInt();
- for (i = 0 ;i < n ;i++ ) {
- int notade100 = n / 100;
- int resto100 = (n - notade100*100);
- int notade50 = resto100 / 50;
- int resto50 = (n - notade100*100 - notade50*50);
- int notade20 = resto50 / 20;
- int resto20 = (n - notade100*100 - notade50*50 - notade20 *20);
- int notade10 = resto20 / 10;
- int resto10 = (n - notade100*100 - notade50*50 - notade20 *20 - notade10 *10);
- int notade5 = resto10 /5;
- int resto5 = (n - notade100*100 - notade50*50 - notade20 *20 - notade10 *10 - notade5 * 5);
- int notade2 = resto5 / 2;
- int resto2 = (n - notade100*100 - notade50*50 - notade20 *20 - notade10 *10 - notade5 * 5 - notade2 *2);
- int notade1 = resto2 / 1;
- System.out.println(n);
- System.out.printf("%d", notade100);
- System.out.println(" nota(s) de R$ 100,00");
- System.out.printf("%d", notade50);
- System.out.println(" nota(s) de R$ 50,00");
- System.out.printf("%d", notade20);
- System.out.println(" nota(s) de R$ 20,00");
- System.out.printf("%d", notade10);
- System.out.println(" nota(s) de R$ 10,00");
- System.out.printf("%d", notade5);
- System.out.println(" nota(s) de R$ 5,00");
- System.out.printf("%d", notade2);
- System.out.println(" nota(s) de R$ 2,00");
- System.out.printf("%d", notade1);
- System.out.println(" nota(s) de R$ 1,00");
- if (n == 0) {
- }
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement