Question: fix this java code: import java.util.Scanner; public class LabProgram { public static void main ( String [ ] args ) { Scanner scanner = new

fix this java code:
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
System.out.print("Enter three integers: ");
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
int smallest = a; // Assume a is the smallest
if (b < smallest){
smallest = b; // Update if b is smaller
}
if (c < smallest){
smallest = c; // Update if c is smaller
}
System.out.println("The smallest number is "+ smallest);
scannerclose();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!