Question
What is iterative statement? Explain use of for-loop and while-loop in Java programming
Answer :
Word Count : 359
____ ____ _______ ______ __________ ______ _____ _____ __________ ___ ___ _______.
_________ ___ ______ ________ ______ _______ ____ _________ _________ ___.
___ ______ ___ ________ ______.
_____ ______ _______ __________ __________ ___ ____.
_____ _________ _____ _______ ___ ________ ____ __________ ____ _________ _____.
_______ ____ ______ _____ _______ ____ __________ ________ ______ ____ _____.
____ ______ _______ ____ ____ _______ ___ ______ ____ __________.
_______ __________ ________ _____ ____ _______ _________ ________ ___ __________ ____.
______ _______ ___ _______ __________ ___ ____ _________ _________ __________ ______.
________ ________ ________ _________ _______ __________ __________.
___ _________ __________ _________ __________ __________.
_______ ________ _______ ____ _________ ________ __________ _________.
________ ___ ___ _______ _______ ___ ___.
_____ _______ ________ _____ _________ ________ ________ ___.
_________ ___ _______ _______ ______ _____.
________ ______ _____ ___ ____ ______.
_________ ____ _______ ____ ______ _______ _______ ________ ______ __________ ___ ___.
____ __________ ______ ____ ______ ____ __________.
_____ _____ __________ ________ ______ _______ __________ _________ ________ ____ __________ ____.
______ ______ _______ ______ ______ __________ _________ _____ ________ ____ _______ ____.
______ ___ _________ __________ ____ ____ ______ _____ ______.
________ _______ _______ _____ ________ ______ __________.
______ _____ ___ ________ __________ _______ ____ ______ ____ ______ ______.
____ ____ ___ _________ ______ ______ ________ _______ _______ _________ ____ ________.
____ _____ ______ ____ _____ ______ ___ __________.
Skip in 10
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.
- 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
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.