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
Chemistry,
4 months ago
Math,
4 months ago
Computer Science,
4 months ago
Math,
8 months ago
English,
8 months ago
Political Science,
11 months ago
Science,
11 months ago
Math,
11 months ago