Question

 What is iterative statement? Explain use of for-loop and while-loop in Java programming

27 Apr 2023
Answer :
Word Count : 359

An iterative statement, also known as a loop, is a programming construct that allows a block of code to be executed repeatedly until a certain condition is met. In Java, two commonly used iterative statements are the for loop and the while loop.

  1. For Loop: The for loop is used when the number of iterations is known in advance. It consists of three parts: initialization, condition, and increment/decrement.

Syntax:

for (initialization; condition; increment/decrement) {
    // code to be executed
}
Example:

for (int i = 1; i <= 5; i++) {
    System.out.println("Count: " + i);
}
In the example, the for loop will execute the code block five times. The variable i is initialized to 1, and as long as the

____ ____ _______ ______ __________ ______ _____ _____ __________ ___ ___ _______.
_________ ___ ______ ________ ______ _______ ____ _________ _________ ___.
___ ______ ___ ________ ______.
_____ ______ _______ __________ __________ ___ ____.
_____ _________ _____ _______ ___ ________ ____ __________ ____ _________ _____.
_______ ____ ______ _____ _______ ____ __________ ________ ______ ____ _____.
____ ______ _______ ____ ____ _______ ___ ______ ____ __________.
_______ __________ ________ _____ ____ _______ _________ ________ ___ __________ ____.
______ _______ ___ _______ __________ ___ ____ _________ _________ __________ ______.
________ ________ ________ _________ _______ __________ __________.
___ _________ __________ _________ __________ __________.
_______ ________ _______ ____ _________ ________ __________ _________.
________ ___ ___ _______ _______ ___ ___.
_____ _______ ________ _____ _________ ________ ________ ___.
_________ ___ _______ _______ ______ _____.
________ ______ _____ ___ ____ ______.
_________ ____ _______ ____ ______ _______ _______ ________ ______ __________ ___ ___.
____ __________ ______ ____ ______ ____ __________.
_____ _____ __________ ________ ______ _______ __________ _________ ________ ____ __________ ____.
______ ______ _______ ______ ______ __________ _________ _____ ________ ____ _______ ____.
______ ___ _________ __________ ____ ____ ______ _____ ______.
________ _______ _______ _____ ________ ______ __________.
______ _____ ___ ________ __________ _______ ____ ______ ____ ______ ______.
____ ____ ___ _________ ______ ______ ________ _______ _______ _________ ____ ________.
____ _____ ______ ____ _____ ______ ___ __________.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCS 206 2022 2023 -  What is iterative statement? Explain use of for-loop and while-l | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→