Array and Functions

0 Uri Skyev · November 5, 2014
I have a project where i am trying to create a process which will store a value in the array which will then output a prompt for the value entered. Ultimately i need want to create a program which will evaluate the values entered unto 100 find the biggest smalls and average from the entered sums.

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

// prototypes as listed above

void GetValues(int x[], int *pN);

int FindBig(int x[], int n);

int FindSml(int x[], int n);

float FindAvg(int x[], int n);

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);

}

float FindAvg(int x[], int n){

int sum = 0;

for (int i = 0; i<n; i++){

sum += x;

}

sum = sum / i;

return sum;

}

void GetValues(int x[], int *pN){

int c;

for (c = 0; c < *pN; c++){

printf("Enter the value %d", c);

scanf("%d", &x
);

}

}



Post a Reply

Replies

Oldest  Newest  Rating
0 Mathias Frits Rørvik · November 11, 2014
What exactly do you need help with? What have you tried?

No one is going to write this program for you, but we are willing to help if you get stuck or encounter any errors.
  • 1

C

106,983 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator