Computer Science, asked by gudi23819, 7 months ago

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 anindyaadhikari13
5

\star\:\:\:\sf\large\underline\blue{Question:-}

  • Write a program to find the smallest of three given integers using min() method of math class.

\star\:\:\:\sf\large\underline\blue{Source\:Code:-}

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 Oreki
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