हिंदी

State the type of loop in the given program segment for (int i = 5; i l = 0; i =2) System.out.println(i); - Computer Applications

Advertisements
Advertisements

प्रश्न

State the type of loop in the given program segment

for (int i = 5; i l = 0; i =2)

System.out.println(i);

विकल्प

  • finite

  • null

  • infinite

  • fixed

MCQ
Advertisements

उत्तर

finite

Explanation:

This loop will execute as follows:

  • Starts at i = 5
  • Decrements i by 2 each time (i -= 2)

  • Runs while i >= 0

  • Values printed: 5, 3, 1
shaalaa.com
Entry Controlled Loop
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2022-2023 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×