Write a program to print the minimum of three numbers. 2
Answers
Answered by
1
Question:-
Write a program to print the minimum of 3 numbers.
Program:-
This is written in Java.
import java.util.*;
class Min
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter first number: ");
int a=sc.nextInt();
System.out.print("Enter second number: ");
int b=sc.nextInt();
System.out.print("Enter third number: ");
int c=sc.nextInt();
int min=Math.min(a, Math.min(b, c));
System.out.println("Smallest number is: "+min);
}
}
Similar questions