Solved

Which of the Following Loops Will Print the Odd Numbers

Question 105

Multiple Choice

Which of the following loops will print the odd numbers between 0 and 20?


A) for (int num = 1; num < 20; num++) {
System.out.print (num % 2 + " ") ;
}
B) for (int num = 0; num < 20; num+= 2) {
System.out.print (num + " ") ;
}
C) for (int num = 1; num < 20; num+= 2) {
System.out.print (num + " ") ;
}
D) for (int num = 0; num < 20; num+= 2) {
If (num % 2 == 1)
System.out.print (num + " ") ;
}

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions