Consider the following code segments.
I)
int k = 1;
while (k < 20)
{
if (k % 3 == 1)
System.out.print(k + " ");
k = k + 3;
}
II)
for (int k = 1; k < 20; k++)
{
if (k % 3 == 1)
System.out.print(k + " ");
}
III)
for (int k = 1; k < 20; k = k + 3)
{
System.out.print(k + " ");
}
Which of the code segments above will produce the following output?
1 4 7 10 13 16 19
A) I only
B) II only
C) I and II only
D) II and III only
E) I, II, and III