fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int total = 0;
  6.  
  7. for (int i = 1; i <= 3; i++) {
  8. int s = 0;
  9. for (int j = 1; j <= 4; j++) {
  10. if ((i + j) % 2 == 0) continue;
  11. s += j;
  12. if (s > 5) break;
  13. }
  14. total += s;
  15. cout << s << " ";
  16. }
  17.  
  18. cout << total;
  19.  
  20. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
6 4 6 16