Continue and break
Source Code
|
|
Run Output
Code Understanding
This program prints all odd numbers from 1 to 20 using a for loop with the continue statement.
• for(int i = 1; i <= 20; i++) → loops from 1 to 20.
• if(i % 2 == 0) continue; → skips the current iteration if i is even.
• cout << i << " "; → prints the number if it is not skipped.
Created: 1-Mar-2026 16:59 | Updated: 1-Mar-2026 17:17|
