Write a program in java to accept three numbers and print the largest of three numbers.
Please answer fast
Answers
Answered by
1
Very simple
Let's begin
I have used if-else according to your basics
class Numbers
public static void main(String[] args)
{
int num1 = 10, num2 = 20, num3 = 7;
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");
}
}
Hopes you will be able to understand
Similar questions