need help for this question

Calculate the biggest of four integers.

The user inputs four integers. Your program will determine the biggest of these four numbers and print out an appropriate message, specifying this biggest value.
You are required to implement and use the following functions for this task:

int bigger( int x, int y );

This function takes two integer parameters and returns the bigger of those two parameters.

void printBiggest( int a, int b, int c, int d );

The function determines the biggest of the four parameters and prints it out using an appropriate message. To determine the biggest number, it needs to use another function bigger( int x, int y )which is defined above.

Recommended Answers

All 5 Replies

I will try to explain the concept. First accept four integers input:

int num1,num2,num3,num4;

printf("Enter 4 integers seperated by space: ");
scanf("%d %d %d %d",num1,num2,num3,num4);

After this, do the function which accepts the two parameters.
For example, you are comparing two integers, num1 and num2:

bigger(num1,num2);

In the function, have a if else statement that checks the two parameters. If num1 is more than num2, then put:

return num1;

This will return the biggest number. Assign the returned value to an int parameter. Put a printf statement if that is necessary. The printbiggest function will compare the four input using the if else statement and determine the biggest value of them. The function bigger() can be called in this function and assigned to an int variable. Then printf it.

commented: thans +0

Actually all you need is to call function bigger 3 times in printbiggest.
If input parameters x i z j bot you will need extra parameter inside function iMax
first you get to know x and y biggest then save it and compare it to z then save it and compare it to j ?

We may help you if you post something it's small program one line in biggest with ternary expre.. and maybe 5 in print biggest

Member Avatar for iamthwee

Make sure you attempt the question. It's no good just posting your homework.

Freebie answers are worthless in the real world. Get used to doing this stuff on your own.

Indeed if you like programming then just sit and do it, there is nothing impossible, you just need time.

ok ~~ i juz don understand wht the question means ~~~
thx guys

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.