Question: ! ! ! PLEASE SOLVE USING C LANGUAGE!! Part 2 ( 3 5 points ) Implement the following function in skeleton code 1 ab 1

!!!PLEASE SOLVE USING C LANGUAGE!! Part 2(35 points)
Implement the following function in skeleton code 1ab1part2. c:
Your task in this part to fill in the missing function definitions in skeleton code lab1part2. c.
main function will stay as it is.
Sample Run:
Enter the number of elements:
5
Enter 5 elements:
12345
Array elements: 12345
Enter the number of elements:
5
Enter 5 elements:
12345
Array elements: 12345
Equal
Average of the first array: 3
Average of the second array: 3!!!!HERE IS THE CODE STRUCTURE/SKELETON CODE lab1part2.c. : #include
#define SIZE 500
// reads numbers from the standard input into arr,
// and stores the number of read elements in the memory cell pointed to by nPtr
void readInput(int arr[], int *nPtr);
// prints the elements in arr[0..(n-1)]
void printNumbers(const int arr[], int n);
// Let n be the minimum of n1 and n2 where n1 and n2 are the number of elements in
// arr1 and arr2, respectively.
// Compare corresponding elements of arr1 and arr2 at each of the first n positions.
//
// If arr1 and arr2 has the same value in each position:
// Return 0 if n1== n2
// Return 1 if n1> n2
// Return -1 if n1 n2
//
// If arr1 has a larger value than arr2 considering the first position from the
// beginning at which arr1 and arr2 have a different value:
// Return 1
//
// If arr1 has a smaller value than arr2 considering the first position from the
// beginning at which arr1 and arr2 have a different value:
// Return -1
int compareTwoArrays(const int arr1[], const int arr2[], int n1, int n2);
int calculateAverage(const int arr[], int n);
int main()
{
int arr1[SIZE];
int n1;
int arr2[SIZE];
int n2;
readInput(arr1, &n1);
printNumbers(arr1, n1);
readInput(arr2, &n2);
printNumbers(arr2, n2);
int result = compareTwoArrays(arr1, arr2, n1, n2);
if (result ==0)
printf("
Equal
");
else if (result ==-1)
printf("
Less than
");
else if (result ==1)
printf("
Greater than
");
int avg1= calculateAverage(arr1, n1);
int avg2= calculateAverage(arr2, n2);
printf("
Average of the first array: %d
", avg1);
printf("Average of the second array: %d
", avg2);
return 0;
}
void readInput(int arr[], int *nPtr)
{
// fill here
}
void printNumbers(const int arr[], int n)
{
// fill here
}
int compareTwoArrays(const int arr1[], const int arr2[], int n1, int n2)
{
// fill here
}
int calculateAverage(const int arr[], int n)
{
// fill here
}
 !!!PLEASE SOLVE USING C LANGUAGE!! Part 2(35 points) Implement the following

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!