Advertisement
Josif_tepe

Untitled

Feb 10th, 2021
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int niza[5];
  6.     for(int i = 0; i < 5; i++) {
  7.         cin >> niza[i];
  8.     }
  9.     int sprat;
  10.     cin >> sprat;
  11.     int zbir = 0;
  12.     for(int i = 0; i < sprat - 1; i++) {
  13.         zbir += niza[i];
  14.     }
  15.     if(zbir == 0) {
  16.         cout << 100 << endl;
  17.     }
  18.     else if(zbir >= 1 and zbir <= 5) {
  19.         cout << 100 - 20 << endl;
  20.     }
  21.     else if(zbir >= 6 && zbir <= 20) {
  22.         cout << 100 - 40 << endl;
  23.     }
  24.     else {
  25.         cout << 100 - 50 << endl;
  26.     }
  27.     return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement