explain the types of iterative statement with an example
Answers
Answer:
Iteration is when the same procedure is repeated multiple times. Some examples were long division, the Fibonacci numbers, prime numbers, and the calculator game.
Answer:
Java's Iteration statements are for, while and do-while. These statements are commonly called as loops. A loop repeatedly executes the same set of instructions until a termination condition is met.
Explanation:
For example, if we want to print Hello for 10 times, we need to call the print statement 10 times. This could be achieved by explicitly calling print statement 10 times as shown below.
System.out.println("Hello");
System.out.println("Hello");
System.out.println("Hello");
System.out.println("Hello");
System.out.println("Hello");
System.out.println("Hello");
System.out.println("Hello");
System.out.println("Hello");
System.out.println("Hello");
System.out.println("Hello");