Greatest of three numbers
School Accuracy: 53.27% Submissions: 4520 Points: 0

Given 3 numbers A, B and C. Find the greatest number among them.

Example 1:

Input: A = 10, B = 3, C = 2
Output: 10
10 is the greatest among the three.

Example 2:

Input: A = -4, B = -3, C = -2
Output: -2
-2 is the greatest among the three.

Your Task:
You don't need to read input or print anything.Your task is to complete the function greatestOfThree() which takes three numbers A,B and C as input parameters and returns the greatest among them.

Expected Time Complexity:O(1)
Expected Auxillary Space:O(1)


We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Greatest of three numbers

Output Window