0% found this document useful (1 vote)
2K views

Lab 3.20 (JAVA)

3.20 LAB: Smallest number Write a program whose inputs are three integers, and whose output is the smallest of the three values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
2K views

Lab 3.20 (JAVA)

3.20 LAB: Smallest number Write a program whose inputs are three integers, and whose output is the smallest of the three values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

3.

20 LAB: Smallest number


Write a program whose inputs are three integers, and whose output is the smallest
of the three values.

Ex: If the input is: 7 15 3


the output is: 3

CODE (JAVA):

import java.util.Scanner;

public class LabProgram {


public static void main(String[] args) {
int num1;
int num2;
int num3;

Scanner scnr = new Scanner(System.in);


num1 = scnr.nextInt();
num2 = scnr.nextInt();
num3 = scnr.nextInt();

int smallest = Math.min(num1, Math.min(num2, num3));

System.out.println(smallest);
}
}

You might also like