Q2. The following algorithm prints the first N odd numbers starting from 1. (5 marks) 1) Identify the problem(s) with th
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Q2. The following algorithm prints the first N odd numbers starting from 1. (5 marks) 1) Identify the problem(s) with th
Q2. The following algorithm prints the first N odd numbers starting from 1. (5 marks) 1) Identify the problem(s) with the given algorithm? Input: number of odd numbers, N Problems Output: First N odd numbers starting from 1 Steps: 1. Set K-1 2. Print K 3. Increment K by 1 4. Go to step 2 5. Stop 2) Fix and rewrite the algorithm to behave according to the description above.