-
-
Save folivetti/59405fd2b1293d609b0573c8e9c2a8ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
class Main { | |
public static void main(String[] args) { | |
int dinheiro, notas; | |
Scanner leitor = new Scanner(System.in); | |
dinheiro = leitor.nextInt(); | |
notas = dinheiro/100; | |
if (notas != 0) { | |
System.out.println(notas + " de cem"); | |
} | |
dinheiro = dinheiro - notas*100; | |
notas = dinheiro/50; | |
if (notas != 0) { | |
System.out.println(notas + " de cinquenta"); | |
} | |
dinheiro = dinheiro - notas*50; | |
notas = dinheiro/20; | |
if (notas != 0) { | |
System.out.println(notas + " de vinte"); | |
} | |
dinheiro = dinheiro - notas*20; | |
notas = dinheiro/10; | |
if (notas != 0) { | |
System.out.println(notas + " de dez"); | |
} | |
dinheiro = dinheiro - notas*10; | |
notas = dinheiro/5; | |
if (notas != 0) { | |
System.out.println(notas + " de cinco"); | |
} | |
dinheiro = dinheiro - notas*5; | |
notas = dinheiro/2; | |
if (notas != 0) { | |
System.out.println(notas + " de dois"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment