Commit 46332c3
committed
feat: Simulate cooling process using break and continue to detect ice formation
🧠 Logic:
- Start with water at 100°C and reduce temperature by 5°C each loop.
- If temperature > 40°C, print warning and `continue` to next iteration (skip thermometer reading).
- Once temperature reaches 0°C or below, print "We have ice!" and `break` the loop.
🎯 Focus:
Demonstrates control flow using `continue` to skip early output and `break` to stop once ice forms.
Signed-off-by: Somesh diwan <[email protected]>1 parent b5802a8 commit 46332c3
1 file changed
+7
-11
lines changedLines changed: 7 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
| 1 | + | |
| 2 | + | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
| 6 | + | |
8 | 7 | | |
9 | | - | |
10 | | - | |
| 8 | + | |
11 | 9 | | |
12 | | - | |
13 | | - | |
| 10 | + | |
14 | 11 | | |
15 | 12 | | |
16 | 13 | | |
17 | 14 | | |
18 | | - | |
19 | | - | |
| 15 | + | |
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
23 | 19 | | |
24 | 20 | | |
25 | | - | |
| 21 | + | |
0 commit comments