Solved

Which of the Following Loops Will Print the Odd Numbers

Question 45

Multiple Choice

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


A) int num = 1;
While (num < 10)
{
Int value = num * 2 - 1;
System.out.print (value + " ") ;
Num ++;
}
B) int num = 1;
While (num < 20)
{
Int value = num * 2 - 1;
System.out.print (value + " ") ;
Num ++;
}
C) int num = 1;
While (num < 10)
{
System.out.print (num + " ") ;
Num += 2;
}
D) int num = 1;
While (num < 20)
{
Num += 2;
System.out.print (num + " ") ;
}

Correct Answer:

verifed

Verified

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

Related Questions