Commit 9fa4986
committed
feat: Use multiple loop variables to print index and exponential growth in for-loop
🧠 Logic:
- The `for` loop initializes two variables: `i = 0` (incremented by 1 each iteration) and `j = 1` (doubles each time: j = j * 2).
- Loop continues while `i <= 10`.
- On each iteration, prints:
- `i`: linear progression (0 to 10)
- `j`: exponential progression (1, 2, 4, 8, ..., 1024)
Signed-off-by: Somesh diwan <[email protected]>1 parent ca1b3d8 commit 9fa4986
1 file changed
+4
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
7 | 4 | | |
8 | 5 | | |
9 | 6 | | |
10 | 7 | | |
11 | | - | |
| 8 | + | |
0 commit comments