SHARE
TWEET

Hitung Kembalian

tukangbegal Jun 2nd, 2020 (edited) 677 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'dart:io';
  2.  
  3.  
  4.  
  5. main(){
  6.  
  7.   stdout.write("Masukan jumlah pembelian : ");
  8.   double pembelian= double.parse(stdin.readLineSync());
  9.  
  10.   stdout.write("Masukan jumlah uang : ");
  11.   double jumlahUang= double.parse(stdin.readLineSync());
  12.  
  13.   hitungKembalian(pembelian, jumlahUang);
  14.  
  15.  
  16. }
  17.  
  18. hitungKembalian(double pembelian, double jumlahUang){
  19.  
  20.   double sisa=jumlahUang-pembelian;
  21.  
  22.   double pecahan1=5000;
  23.   double pecahan2=10000;
  24.   double pecahan3=20000;
  25.   double pecahan4=50000;
  26.  
  27.  
  28.   if(sisa>=pecahan4){
  29.  
  30.     sisa=sisa-pecahan4;
  31.  
  32.     print("1 x $pecahan4");
  33.  
  34.  
  35.   }
  36.  
  37.   if(sisa>=pecahan3){
  38.  
  39.  
  40.     sisa=sisa-pecahan3;
  41.  
  42.     print("1 x $pecahan3");
  43.   }
  44.  
  45.  if(sisa>=pecahan2){
  46.  
  47.  
  48.     sisa=sisa-pecahan2;
  49.  
  50.     print("1 x $pecahan2");
  51.   }
  52.  
  53.    if(sisa>=pecahan1){
  54.    
  55.  
  56.     sisa=sisa-pecahan1;
  57.  
  58.     print("1 x $pecahan1");
  59.     }
  60.  
  61.   if(sisa<pecahan1&&sisa>0){
  62.     print("$sisa Disumbangkan karena tidak ada pecahan dibawah $pecahan1");
  63.   }
  64.  
  65.  
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top