Write a program using Basic whose inputs are three integers, and whose output is the largest of the three values.
Answers
Answer:
import java.util.Scanner;
import java.util.Scanner;public class largest
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Input the 1st number: ");
int num1 = in.nextInt();
System.out.print("Input the 2nd number: ");
int num2 = in.nextInt();
System.out.print("Input the 3rd number: ");
int num3 = in.nextInt();
if (num1 > num2)
if (num1 > num3)
System.out.println("The greatest: " + num1);
if (num2 > num1)
if (num2 > num3)
System.out.println("The greatest: " + num2);
if (num3 > num1)
if (num3 > num2)
System.out.println("The greatest: " + num3);
}
}
Answer:
import java.util*;
class Integers
{
public void check()
{
Scanner sc = newScanner(System.in);
System.out.println("Enter 1st Integer:")
double n1 = sc.nextDouble();
System.out.println("Enter 2nd Integer:")
double n2 = sc.nextDouble();
System.out.println("Enter 3rd Integer:")
double n3 = sc.nextDouble();
if(n1> n2 && n1 > n3)
System.out.println( "First Integer has Largest value");
else if(n2> n1 && n2 > n3)
System.out.println( "Second Integer has Largest value");
else(n3> n2 && n3 > n1)
System.out.println( "Third Integer has Largest value");
}
}
Please Mark as Brainliest Answer ❤️
Please Follow me ❤️
Please Thank my answers ❤️