Advertisement
Spocoman

Gifts from Santa

Sep 20th, 2023
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int n, m, s;
  8.     cin >> n >> m >> s;
  9.  
  10.     for (int i = m; i >= n; i--) {
  11.         if (i == s && s % 2 == 0 && s % 3 == 0) {
  12.             break;
  13.         }
  14.         else if (i % 2 == 0 && i % 3 == 0) {
  15.             cout << i << " ";
  16.         }
  17.     }
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement