Advertisement
Josif_tepe

Untitled

Nov 19th, 2021
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.78 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int niza[5];
  8.     for(int i = 0; i < 5; i++)
  9.     {
  10.         cin >> niza[i];
  11.     }
  12.     int kabinet;
  13.     cin >> kabinet;
  14.     int internet = 100;
  15.     if (kabinet == 1)
  16.     {
  17.         cout << internet << endl;
  18.         return 0;
  19.     }
  20.     else if(kabinet == 2)
  21.     {
  22.         if(niza[0] <= 5 and niza[0] > 0)
  23.         {
  24.             internet -= 20;
  25.         }
  26.         else if(niza[0] >= 6 and niza[0]<= 20)
  27.         {
  28.             internet -= 40;
  29.         }
  30.         else if(niza[0] > 20)
  31.         {
  32.             internet -= 50;
  33.         }
  34.         cout << internet << endl;
  35.     }
  36.     else if(kabinet == 3)
  37.     {
  38.         int zbir = niza[0] + niza[1];
  39. if(zbir <= 5 and zbir > 0)
  40.         {
  41.             internet -= 20;
  42.         }
  43.         else if(zbir >= 6 and zbir <= 20)
  44.         {
  45.             internet -= 40;
  46.         }
  47.         else if(zbir > 20)
  48.         {
  49.             internet -= 50;
  50.         }
  51.         cout << internet << endl;
  52.     }
  53.     else if(kabinet == 4)
  54.     {
  55.         int zbir = niza[0] + niza[1] + niza[2];
  56.         if(zbir <= 5 and zbir > 0)
  57.         {
  58.             internet -= 20;
  59.         }
  60.         else if(zbir >= 6 and zbir <= 20)
  61.         {
  62.             internet -= 40;
  63.         }
  64.         else if(zbir > 20)
  65.         {
  66.             internet -= 50;
  67.         }
  68.         cout << internet << endl;
  69.     }
  70.     else if(kabinet == 5)
  71.     {
  72.         int zbir = niza[0] + niza[1] + niza[2] + niza[3];
  73.         if(zbir <= 5 and zbir > 0)
  74.         {
  75.             internet -= 20;
  76.         }
  77.         else if(zbir >= 6 and zbir <= 20)
  78.         {
  79.             internet -= 40;
  80.         }
  81.         else if(zbir > 20)
  82.         {
  83.             internet -= 50;
  84.         }
  85.         cout << internet << endl;
  86.     }
  87.     return 0;
  88. }
  89.  
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement