Advertisement
Josif_tepe

Untitled

May 19th, 2024
699
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int z = 0;
  7.     int i;
  8.     for(i = 1; i <= 10; i++) {
  9.         if((i % 3) == 0) {
  10.             z += i; // z = 18
  11.         }
  12.     }
  13.     cout << z << endl;
  14.     return 0;
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement