0
Write a program that accepts three intergers from user and display maximum interger?
I need answer guys
1 Answer
+ 1
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
int firstNum, secondNum, thirdNum ;
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a number: ");
firstNum=scanner.nextInt();
System.out.print("Enter second number: ");
secondNum=scanner.nextInt() ;
System.out.print("Enter third number: ");
thirdNum=scanner.nextInt() ;
if(firstNum >secondNum)
System.out.println(firstNum+ " is largest") ;
else if (secondNum>thirdNum)
System.out.println(secondNum+" is largest") ;
else
System.out.println(thirdNum+" is largest ") ;
}
}