Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

c Code Specification of Functions Part A] Write a function named \"Reverse\" wit

ID: 2248312 • Letter: C

Question

c Code Specification of Functions Part A] Write a function named "Reverse" with the following specifications: 1. An argument of an array of integer values referred to as ZArray 2. An argument of an integer Size that indicates the number of elements o f ZArray 3. No return value The function scans each position of the ZArray/) and reverses the position of the values. For example, if the array passed to the function looks like this: Example O: ZArray Index position: 0 1 2 ZArray values 21 -41 1 The changed array will be: 1-4 2 Example 1: ZArray: Index position: 0 1 2 3 4 5 ZArray values 2-41 11 61719 The changed array will be: 9761-42

Explanation / Answer

Code for first question:

#include<stdio.h>

void Reverse(int ZArray[],int n){
int newarray[n];
int i;
//apply a for loop to reverse the position of elements.
for (i=0;i<n;i++){
newarray[n-i-1] = ZArray[i];

}

//for loop to display arrays
printf(" Entered array: ");
for(i=0;i<n;i++){

printf("%d ",ZArray[i]);
}

printf(" Modified array: ");
for(i=0;i<n;i++){

printf("%d ",newarray[i]);
}
}


int main(){
//this is normal declaration of c-code
//Now create a variable to store size of array, index variable i
int n, i;
//Ask user for size of array
printf("Please enter size of array. ");
scanf("%d",&n);

//now create two arrays of mentioned size
int array1[n];

//ask user to enter elements
printf(" Please enter elements of array one by one. ");
//start a for loop to collect the elements.
for (i=0;i<n;i++)
{
scanf("%d",&array1[i]);
}
//Now pass the array to function ZArray.
Reverse(array1,n);

return 0;

}

Code for 2nd question:

#include<stdio.h>
int main(){
//create an index variable to keep track of number of numbers entered.
int n=0;
//create a variable to store largest non-negative number entered
float l=0;
//create a variable to fetch the number entered
float v;
//create an array big enough to store numbers.
float array[100];
//put a while loop to go on asking user to enter number until condition is met
while (v!=0 && v>0) {
printf("Enter a number: ");
scanf("%f",&v);
array[n]=v;
n++;

if(v>l)
l=v;

}

printf(" The largest number entered was: %f & number of numbers entered was: %d",l,n);


return 0;}

Please post such different questions individually according to Chegg policy.

Please post rest of the questions individually, we will help you ASAP!.

For any clarification needed with above codes, please let me know in the comments.

Please leave a thumbs up.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote