Guest User

Untitled

a guest
Jan 11th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. double[] tablica = new double[] {200, 100, 50, 20, 10, 5, 2, 1, 0.50, 0.20, 0.10, 0.05, 0.02, 0.01};
  2. for (int i=0; tablica.length>i;i++)
  3. { double x = Math.floor(kwota/tablica[i]);
  4. if(x!=0.0){
  5. if (tablica[i]>=1){
  6.  
  7. kwota = kwota-(x*tablica[i]);
  8. System.out.println(Math.round(tablica[i]) + "zł x " + Math.round(x));}
  9. else{
  10. kwota = kwota-(x*tablica[i]);
  11. System.out.println(Math.round(tablica[i]*100) + "gr x " + Math.round(x));}
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment