13026 - Third Largest Number   

Description

Implement the C function find_third_largest() that finds the 3rd largest number of four numbers and store the result in the fifth argument. The prototype for the function is as follows:


void find_third_largest(const int*num1, const int*num2, const int*num3, const int*num4, int* ptr_result);
 
Assume that the main function that calls this function looks like this:
 
int main() {    
    int num1, num2, num3, num4, third_largest;   
    scanf("%d %d %d %d", &num1, &num2, &num3, &num4);   
    find_third_largest(&num1, &num2, &num3, &num4, &third_largest);   
    printf("The 3rd largest element is %d\n", third_largest);    
    return 0;
}
 
You need to implement the function and submit it as follow:
 
void find_third_largest(const int* num1, const int* num2, const int* num3, const int* num4, int* ptr_result){
...
...
}

Input

A list of four integers.

Output

"The 3rd largest element is X\n"

Sample Input  Download

Sample Output  Download

Partial Judge Code

13026.c

Partial Judge Header

13026.h

Tags




Discuss