Loop Iteration Control in Programming

Which loop is preferred to use when the programmer knows in advance how many times the body of the loop will be executed?

جب پروگرامر کو پہلے ہی معلوم ہوتا ہے کہ لوپ کے جسم کو کتنی بار عمل میں لایا جائے گا تو کس لوپ کو استعمال کرنے کو ترجیح دی جاتی ہے؟
Answer: For
Explanation

The for loop is ideal when the number of iterations is known beforehand.

It allows initializing, testing, and updating the loop variable in a single line.

This question appeared in Past Papers (7 times)
This question appeared in Subjects (1 times)

Install this app on your device for quick access right from your home screen.