write a java program to input three numbers and point out largest number by using max() function..
no spam..
correct answer will be followed and marked as brainliest.. and 10 thanks from me.
Answers
Answered by
2
Answer:
Explanation:
import java.util.Scanner;
public class Largestnum{
public static void max(int num1,int num2,int num3) {
if( num1 >= num2 && num1 >= num3)
System.out.println(num1+" is the largest Number");
else if (num2 >= num1 && num2 >= num3)
System.out.println(num2+" is the largest Number");
else
System.out.println(num3+" is the largest Number");
}
public static void main(String[] args) {
int a,b,c;
Scanner sc=new Scanner(System.in);
System. out. print("Enter the first number:");
a= sc. nextInt();
System. out. print("Enter the second number:");
b= sc. nextInt();
System. out. print("Enter the third number:");
c= sc. nextInt();
max(a,b,c);
}
}
Similar questions