मराठी

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

Advertisements
Advertisements

प्रश्न

State the type of loop in the given program segment

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

System.out.println(i);

पर्याय

  • finite

  • null

  • infinite

  • fixed

MCQ
Advertisements

उत्तर

infinite

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
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 1: Revision of Class 9 Syllabus - Exercises [पृष्ठ ४३]

APPEARS IN

रूपा पंडित Computer Applications [English] Class 10 ICSE
पाठ 1 Revision of Class 9 Syllabus
Exercises | Q 1. (xxv) | पृष्ठ ४३
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×