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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started