Answered step by step
Verified Expert Solution
Question
1 Approved Answer
! ! ! 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 points
Implement the following function in skeleton code abpart c:
Your task in this part to fill in the missing function definitions in skeleton code labpart c
main function will stay as it is
Sample Run:
Enter the number of elements:
Enter elements:
Array elements:
Enter the number of elements:
Enter elements:
Array elements:
Equal
Average of the first array:
Average of the second array: HERE IS THE CODE STRUCTURESKELETON CODE labpartc : #include
#define SIZE
reads numbers from the standard input into arr,
and stores the number of read elements in the memory cell pointed to by nPtr
void readInputint arr int nPtr;
prints the elements in arrn
void printNumbersconst int arr int n;
Let n be the minimum of n and n where n and n are the number of elements in
arr and arr respectively.
Compare corresponding elements of arr and arr at each of the first n positions.
If arr and arr has the same value in each position:
Return if n n
Return if n n
Return if n n
If arr has a larger value than arr considering the first position from the
beginning at which arr and arr have a different value:
Return
If arr has a smaller value than arr considering the first position from the
beginning at which arr and arr have a different value:
Return
int compareTwoArraysconst int arr const int arr int n int n;
int calculateAverageconst int arr int n;
int main
int arrSIZE;
int n;
int arrSIZE;
int n;
readInputarr &n;
printNumbersarr n;
readInputarr &n;
printNumbersarr n;
int result compareTwoArraysarr arr n n;
if result
printf
Equal
;
else if result
printf
Less than
;
else if result
printf
Greater than
;
int avg calculateAveragearr n;
int avg calculateAveragearr n;
printf
Average of the first array: d
avg;
printfAverage of the second array: d
avg;
return ;
void readInputint arr int nPtr
fill here
void printNumbersconst int arr int n
fill here
int compareTwoArraysconst int arr const int arr int n int n
fill here
int calculateAverageconst int arr int n
fill here
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