Consider the following code snippet. Assuming that the user enters first 20 and then 12 as the two input values, what is the output of the code snippet?
int num1 = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int num5 = 0;
Scanner in = new
Scanner(System.in);
System.out.print("Enter a number: ");
num1 = in.nextInt();
System.out.print("Enter a number: ");
num2 = in.nextInt();
if (num1 < num2)
{
num3 = num1;
}
else
{
num3 = num2;
}
if (num1 < num2 + 10)
{
num4 = num1;
}
else if (num1 < num2 + 20)
{
num5 = num1;
}
System.out.println("num1 = " + num1 + " num2 = " + num2 + " num3 = " + num3 + " num4 = " + num4 + " num5 = " + num5);
|
a. num1 = 20 num2 = 12 num3 = 20 num4 = 20 num5 = 0 |
||
|
b. num1 = 20 num2 = 12 num3 = 12 num4 = 0 num5 = 20 |
||
|
c. num1 = 20 num2 = 12 num3 = 12 num4 = 20 num5 = 0 |
||
|
d. num1 = 20 num2 = 12 num3 = 20 num4 = 0 num5 = 20 |
Consider the following code snippet. Assuming that the user enters first 20 and then 12 as...