Write a program in java to enter three numbers and find the smallest and greatest number among them
Answers
Answered by
7
import java.util.*;
public class Number
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int m,k,s,p,l;
System.out.println("Enter three numbers");
m=in.nextInt();
k=in.nextInt();
s=in.nextInt();
p= Math.min(m,k,s);
l= Math.max(m,k,s);
System.out.println("The smallest number is" +p);
System.out.println("The greatest number is" +l);
}
}
Answered by
0
Answer:
Parameters used in First Java Program
Let's see what is the meaning of class, public, static, void, main, String[], System.out.println(). class keyword is used to declare a class in java. public keyword is an access modifier which represents visibility. ... main represents the starting point of the program.
Similar questions