Unsolved Java Programs:
Write a program to input three numbers(positive or negative).if they are unequal
then display the greatest number otherwise,display they are equal.The program also displays whether the numbers entered by the user
are 'All positive', 'All negative' or
"Mixed numbers.
Sample Input: 56, -15, 12
Sample Output: The greatest number is 56
Entered numbers are mixed numbers.
Answers
Answer:
HER IS YOUR ANSWER : -
import java.util.Scanner;
public class Greater_number
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input first number: ");
int n1 = in.nextInt();
System.out.print("Input second number: ");
int n2 = in.nextInt();
System.out.print("Input third number: ");
int n3 = in.nextInt();
if(n1 >= n2)
{
if(n1 >= n3)
System.out.println(n1 + " is the largest number.");
else
System.out.println(n3 + " is the largest number.");
}
else
{
if(n2 >= n3)
System.out.println(n2 + " is the largest number.");
else
System.out.println(n3 + " is the largest number.");
}
if (n1<0 && n2< 0 && n3<0)
System.out.println(" Entered numbers are negative numbers.");
else if (n1>0 && n2> 0 && n3>0)
System.out.println(" Entered numbers are positive numbers.");
else
System.out.println(" Entered numbers are mixed numbers..");
}
}
i hope his helped you, plz rate accordingly.
hope you like it and plz follow me and marked it as brainlist ♥️♥️♥️♥️♥️♥️