Advertisement
krasio12356

Poll

Apr 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5.                                                    // Poll
  6. int main()
  7. {
  8.     int men, votefirst;
  9.     cin >> men >> votefirst;
  10.     double votesecond = votefirst * 0.8;
  11.     double votethird = votesecond * 0.9;
  12.     double votethree = votefirst + votesecond + votethird;
  13.     double half = men / 2;
  14.     double votediff = floor(votethree - half);
  15.     if (votediff >= 0)
  16.     {
  17.         printf("First three languages have %.0f votes more\n", votediff);
  18.     }
  19.     else
  20.     {
  21.         printf("First three languages have %.0f votes less of half votes\n", abs(votediff));
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement