Computer Applications
Write a program to print the largest of three numbers.
Java
Java Conditional Stmts
58 Likes
Answer
public class KboatLargestNumber
{
public static void largestNumber(int a, int b, int c) {
System.out.println("The three numbers are "
+ a + ", " + b + ", " + c);
System.out.print("Largest Number: ");
if (a > b && a > c)
System.out.println(a);
else if (b > a && b > c)
System.out.println(b);
else
System.out.println(c);
}
}
Output
![BlueJ output of Write a program to print the largest of three numbers. BlueJ output of Write a program to print the largest of three numbers.](https://cdn1.knowledgeboat.com/img/lgx8/c6-decision-control-p8.jpg)
Answered By
32 Likes
Related Questions
Write a program to print all the prime numbers between 1 and 100.
Write a Java program using the switch case to print the corresponding days of numbers.
For example: 1= Monday…. 7 = Sunday
Write a program to print the Fibonacci series upto 10 terms.
[A series of numbers in which each number is the sum of the two preceding numbers.For example: 0,1,1,2,3, …………… n].
Create a program to display whether the entered character is in uppercase or lowercase.