Advertisement
Josif_tepe

Untitled

Mar 13th, 2023
873
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.     int a, b;
  5.     cin >> a >> b;
  6.    
  7.     int brojac = 0;
  8.     int zbir = 0;
  9.    
  10.     while(a <= b) {
  11.         if(a % 2 == 0) {
  12.             brojac++;
  13.             zbir += a;
  14.         }
  15.         a++;
  16.     }
  17.     cout << brojac << endl;
  18.     cout << zbir << endl;
  19.        
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement