Complete this program, prompting the user to to enter two positive numbers a and b so that a is less than b. import java.util.Scanner; public class TwoNumbers { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a; int b; // HINT: Choose an appropriate loop and a loop condition /* Your code goes here */ { System.out.println( "Enter two positive integers, the first smaller than the second."); a = in.nextInt(); System.out.println("First: " + a); b = in.nextInt(); System.out.println("Second: " + b); } /* Your code goes here */ // This line should only be printed when the input is correct System.out.println("You entered " + a + " and " + b); } Only add code after your code goes here
Complete this
import java.util.Scanner;
public class TwoNumbers
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int a;
int b;
// HINT: Choose an appropriate loop and a loop condition
/* Your code goes here */
{
System.out.println(
"Enter two positive integers, the first smaller than the second.");
a = in.nextInt();
System.out.println("First: " + a);
b = in.nextInt();
System.out.println("Second: " + b);
} /* Your code goes here */
// This line should only be printed when the input is correct
System.out.println("You entered " + a + " and " + b);
}
Only add code after your code goes here
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images