Write a function definition for a function which accepts three
values from the main program and prints the largest of the three
values.
DO NOT WRITE AN ENTIRE PROGRAM. DO NOT WRITE THE STATEMENT THAT
CALLS THE FUNCTION!
JUST WRITE THE LINES OF CODE FOUND IN THE FUNCTION
DEFINITION
PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE, IF YOU
NEED ANY MODIFICATION THEN LET ME KNOW, I WILL DO IT FOR YOU
JAVA
public static void largest(int a, int b, int c) {
if (a > b && a > c) {
System.out.println("Greatest number among three is:" + a);
} else if (b > c) {
System.out.println("Greatest number among three is:" + b);
} else {
System.out.println("Greatest number among three is:" + c);
}
}
C++
void largest(int a, int b, int c)
{
if (a > b && a > c)
{
cout << "Greatest number among three is:" << a;
}
else if (b > c)
{
cout << "Greatest number among three is:" << b;
}
else
{
cout << "Greatest number among three is:" << c;
}
}
Get Answers For Free
Most questions answered within 1 hours.