Rewrite the following code fragment using a for loop instead of a while loop.
int i = 0;
while(i < 50) {
System.out.println(i);
i+=2;
}
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q21: What is wrong with the following snippet
Q22: Write a code fragment that determines how
Q23: An infinite loop is a compile-time error.
Q24: Write a code fragment that allows a
Q25: A Scanner object can use delimiters other
Q27: The following code compiled, but while running
Q28: It is possible to implement a switch
Q29: Write a switch statement that switches on
Q30: Write a short code fragment that uses
Q31: Rewrite the following for loop as a
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents