Consider the code below that prompts the user to input values for x and for y. It then prints the bigger value contained in the variables x and y. import java.util.Scanner; public class SmallestInt { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter a value for x:"); int x = scan.nextInt();
Consider the code below that prompts the user to input values for x and for y. It then prints the bigger value contained in the variables x and y.
import java.util.Scanner;
public class SmallestInt
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Enter a value for x:");
int x = scan.nextInt();
System.out.println("Enter a value for y:");
int y = scan.nextInt();
if (x >= y)
System.out.println("The bigger value was " + x);
else
System.out.println("The bigger value was " + y);
}
}
Modify the code above so that it prompts the user to enter a third value for a variable z.
Then rewrite the logic above so that the

Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images









