Guest User

Untitled

a guest
Jan 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. package pl.sda.kursjava.zadania;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Zad4 {
  6.  
  7. public static void main(String[] args) {
  8.  
  9. Scanner sc = new Scanner(System.in);
  10. System.out.println("Podaj wartość: ");
  11.  
  12. int wartośćWejściowa = sc.nextInt();
  13.  
  14. int[] tabBanknotów = new int[]{500, 200, 100, 50, 20, 10};
  15.  
  16. for (int i = 0; i < tabBanknotów.length ; i++) {
  17.  
  18. int iilośćBanknotów = wartośćWejściowa / tabBanknotów[i];
  19.  
  20. System.out.println("Liczba banknotów o nominale " +tabBanknotów[i]+ ":" + iilośćBanknotów);
  21.  
  22. wartośćWejściowa = wartośćWejściowa - (iilośćBanknotów*tabBanknotów[i]);
  23. }
  24.  
  25. }
  26. }
Add Comment
Please, Sign In to add comment