Can anyone help me write this program in C. Im drawing a blank right now and cant figure out what Im Supposed to do. I know that the User is supposed to input a number of values then input each value individually. I wrote a little bit of the program but Im getting a ton of errors.
Sending and Scanning an Array in C?
I dont really understand what i'm supposed to do here. It supposed to scan the user input values in an array then figure out which is the smallest, biggest, and average
The prototypes for the functions must be:
void GetValues(int x[], int *pN);
int FindBig(int x[], int n);
int FindSml(int x[], int n);
float FindAvg(int x[], int n);
GetValues should put values in both the x[] array and at *pN
FindBig should return the largest integer in the first n elements of x[]
FindSml should return the smallest integer in the first n elements of x[]
FindAvg should return the average of the first n elements of x[]
Thus, the main program should look something like the following:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
// prototypes as listed above
void main()
{
int a[100], myBig, mySml, n;
float myAvg;
GetValues(a,&n);
myBig=FindBig(a,n);
mySml=FindSml(a,n);
myAvg=FindAvg(a,n);
printf("The largest value is: %d\n",myBig);
printf("The smallest value is: %d\n",mySml);
printf("The average value is: %.2f\n",myAvg);
}
Example of What Its Supposed to Do.
Enter number of integer values: 5
Enter value 1: 20
Enter value 2: -15
Enter value 3: 90
Enter value 4: 2
Enter value 5: 30
The largest value is: 90
The smallest value is: -15
The average value is: 25.40