Advertisements
Advertisements
प्रश्न
Select the infinite loop:
पर्याय
for(int i=1;i<=10;i++)for(int i=2; i!=0 ;i-=3)for(int i=5 ;i<=5;i++)for(int i =1;i>=1; i - -)
MCQ
रिकाम्या जागा भरा
Advertisements
उत्तर
for(int i=2; i!=0 ;i-=3)
Explanation:
- The loop starts with the initial value i = 2. In each iteration, the value of i is decreased by 3 (
i -= 3). The loop condition isi != 0. - As the value of i changes as 2, −1, −4, −7, …, it will never become 0. Therefore, the condition
i != 0always remains true, and the loop never terminates, making it an infinite loop.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2024-2025 (March) Official Board
