Click here to Skip to main content
15,886,565 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Rita is very happy about the successful completion of pattern game by her students. By that time, Disneyland project manager announced a Mini project related to mathematical calculations. Rita thought of taking up that Mini project and completing it with the help of her students. She took that project, and then she splits the project into separate modules and hands it over to each student. The first module is to find maximum among three numbers.

Rita instructed students to follow the function specification strictly. Rita allotted this function to Patrick.


Help Patrick to write a program to find the maximum of 3 numbers using functions.


Function Specification:

int findmaximum(int, int, int )



Input Format:

Input consists of 3 integers.



Output Format:

Refer sample input and output for formatting details.


Sample Input:

13

45

23

Sample Output:

45 is the maximum number

What I have tried:

#include<stdio.h>
int findmaximum (int a,int b,int c){
int temp;
if(a*b)&&(a>c){
temp=a;
Posted
Updated 10-Apr-18 1:41am
Comments
Richard MacCutchan 10-Apr-18 5:04am    
Think about how you would find the maximum of three numbers. Multiplying the first two together does not seem like a good idea.
GKP1992 10-Apr-18 5:08am    
You need to do your homework yourself. Try it and then ask here what you do not understand or cannot seem to work out.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
I agree with GKP1992 and OriginalGriff.

Giving you the whole code wouldn't let you really think about the problem and how to solve it, but maybe this process can be stimulated by giving you a hint:

Think about how many steps you would take to solve this question with basic math operations. Also, specify the data you need to use in each operation to achieve your goal.

If you still don't know where to start, try writing pseudo-code on a piece of paper and work your way to the solution.

Good luck! ;)
 
Share this answer
 
v2
You know, in order to find the maximum among a set of values, you pick a candidate and check if it is bigger than (or, at least, equal to) all the other ones.
In case of successfull candidate, you've done. In case of failure, you pick another one.
It doesn't look rocket science.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900