Advertisement
Josif_tepe

Untitled

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