Please provide the code for a while loop which does exactl
/* * Please provide the code for a while loop which does exactly the * same thing as the below for loop. */ public static void main(String[] args) { for(int i=22; i<=35; i++) { System.out.println(\"counter: \" + i); } } } Solution
For Loop-
for loop is used to execute a set of statements repeatedly until a particular condition is satisfied. we can say it an open ended loop. General format is,
In for loop we have exactly two semicolons, one after initialization and second after condition. In this loop we can have more than one initialization or increment/decrement, separated using comma operator. for loop can have only one condition.
While Loop-
while loop can be addressed as an entry control loop. It is completed in 3 steps.
Syntax :
variable initialization ;
HERE AS PER YOUR QUESTION WHILE LOOP IS-
![/* * Please provide the code for a while loop which does exactly the * same thing as the below for loop. */ public static void main(String[] args) { for(int i= /* * Please provide the code for a while loop which does exactly the * same thing as the below for loop. */ public static void main(String[] args) { for(int i=](/WebImages/32/please-provide-the-code-for-a-while-loop-which-does-exactl-1091298-1761574671-0.webp)