write a program in java to accept three unequal numbers from the user and print the greatest and least among them
Answers
Answered by
10
Answer:
import java.util.*;
class GreatLeast
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter 3 numbers");
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
if(a>b && a>c)
System.out.println(a+" is greatest number");
else if(b>a && b>c)
System.out.println(b+" is greatest number");
else
System.out.println(c+" is greatest number");
if(a<b&& a<c)
System.out.println(a+" is least number");
else if(b<a && b<c)
System.out.println(b+" is least number");
else
System.out.println(c+" is least number");
}
}
Thank you
PLS MARK ME BRAINLIEST
Similar questions