write an if statement program in java to find the smallest of three given integers using min() method of the Math class.
Plz solve it quickly and don't give any useless message otherwise I will report.
Answers
Answered by
5
- Write a program to find the smallest of three given integers using min() method of math class.
import java.util.*;
class Min
{
public static void main(String s[])
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter three integers. ");
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int min=Math.min(a, Math.min(b, c));
System.out.println("The minimum number is: "+min);
}
}
Answered by
6
import java.util.Scanner;
public class Minimum {
public static void main(String[ ] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter three numbers - ");
System.out.println("Minimum number - " + Math.min(sc.nextInt( ), Math.min(sc.nextInt( ), sc.nextInt( ))));
}
}
Similar questions