evelond

Ticket Office Sololearn

Jun 21st, 2021
494
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // why min is not correct each time?
  2.  
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. double ages[5];
  9. double min = 0;
  10. double discount = 1;
  11.     for (int i = 0; i < 5; i++)
  12.   {
  13.         cin >> ages[i];
  14.        min = ages[0];
  15.             if(ages[i]<min)
  16.         min = ages[i];
  17.             discount =  (100.00-min)/100.00*5.00*10.00;          
  18.   }
  19.  
  20.   cout << discount;
  21.     return 0;
  22. }
RAW Paste Data