Question: c program need same output A28 - WAP to find 3rd largest element in an array Description: Read size and array elements from the user.

c program need same output

A28 - WAP to find 3rd largest element in an array

Description:

Read size and array elements from the user. You need to find 3rd largest element in the array without sorting or modifying the array.

You need to pass array to the function. U need to collect array as pointer inside a function as shown below:

int third_largest(int *arr, int size);

In function you need to find third largest element of the array and you need to return it to the main

Pre-requisites:

Arrays

Functions

Pointers

Sample Execution: Test Case 1: Enter the size of the Array : 5 Enter the elements into the array: 5 1 4 2 8 Third largest element of the array is 4 Test Case 2: Enter the size of the Array : 4 Enter the elements into the array: 66 22 11 3 Third largest element of the array is 11

A28 - WAP to find 3rd largest element in an array

Available from: Friday, 22 April 2022, 12:23 PM Due date: Monday, 6 May 2024, 11:59 PM Requested files: third_largest.c ( Download) Type of work: Individual work Reduction by automatic evaluation: 10 Free evaluations: 10

Description:

Read size and array elements from the user. You need to find 3rd largest element in the array without sorting or modifying the array.

You need to pass array to the function. U need to collect array as pointer inside a function as shown below:

int third_largest(int *arr, int size);

In function you need to find third largest element of the array and you need to return it to the main

Pre-requisites:

Arrays

Functions

Pointers

Sample Execution: Test Case 1: Enter the size of the Array : 5 Enter the elements into the array: 5 1 4 2 8 Third largest element of the array is 4 Test Case 2: Enter the size of the Array : 4 Enter the elements into the array: 66 22 11 3 Third largest element of the array is 11

requested files

#include

int third_largest(int [], int);

int main() { int size, ret; //Read size from the user printf("Enter the size of the array :"); scanf("%d", &size); int arr[size]; //Read elements into the array //funtion call ret = third_largest(arr, size); printf("Third largest element of the array is %d ", ret); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!