Commit 1f56cfa
committed
feat: Accept array input from user and print even numbers
🧠 Logic:
- Read the array size `n` from the user and create an array `A` of size `n`.
- Accept `n` elements from the user using a for loop.
- Traverse the array and check each element:
- If the element is divisible by 2 (`A[i] % 2 == 0`), print it as an even number.
Signed-off-by: Somesh diwan <[email protected]>1 parent 8253cd1 commit 1f56cfa
1 file changed
+7
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 3 | + | |
| 4 | + | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
| 9 | + | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
15 | | - | |
| 13 | + | |
16 | 14 | | |
17 | 15 | | |
18 | | - | |
19 | 16 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
24 | 20 | | |
25 | 21 | | |
26 | 22 | | |
| |||
0 commit comments