josiftepe

Untitled

Nov 8th, 2020
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     int ocenka;
  7.     cin >> ocenka;
  8.     int testovi[4]; // niza od broevi
  9.     for(int i = 0; i < 4; i++) { // i++ e isto so i += 1
  10.         cin >> testovi[i]; // vnesuvanje na nizata
  11.     }
  12.     int potrebni_poeni = -1;
  13.     for(int poeni = 0; poeni <= 100; poeni++) { // poeni++ e isto so poeni += 1
  14.         int prosek = (testovi[0] + testovi[1] + testovi[2] + testovi[3] + poeni) / 5;
  15.         if(prosek >= 60 and ocenka == 2) {
  16.             potrebni_poeni = poeni;
  17.             break;
  18.         }
  19.         if(prosek >= 70 and ocenka == 3) {
  20.             potrebni_poeni = poeni;
  21.             break;
  22.         }
  23.         if(prosek >= 80 and ocenka == 4) {
  24.             potrebni_poeni = poeni;
  25.             break;
  26.         }
  27.         if(prosek >= 90 and ocenka == 5) {
  28.             potrebni_poeni = poeni;
  29.             break;
  30.         }
  31.     }
  32.     if(potrebni_poeni == -1) {
  33.         cout << "GRESHKA" << endl;
  34.     }
  35.     else {
  36.         cout << potrebni_poeni << endl;
  37.     }
  38.     return 0;
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment