Advertisement
Josif_tepe

Untitled

Apr 11th, 2023
661
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int A, B;
  6.     cin >> A;
  7.     cin >> B;
  8.    
  9.     int parni_broevi = 0, zbir = 0;
  10.    
  11.     int i = A;
  12.     while(i <= B) {
  13.         if(i % 2 == 0) {
  14.             zbir += i;
  15.             parni_broevi++;
  16.         }
  17.         i++;
  18.     }
  19.     cout << "Broj na parni broevi: " << parni_broevi << endl;
  20.     cout << "Zbir " << zbir << endl;
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement