int sum(int num[] , int size);
int average(int result , int size);
void main()
{
int numbers[SIZE ];
int result;
int averages;
for(int i =0 ; i < SIZE ; i++)
{
numbers[i] = rand();
}
result = sum(numbers , SIZE );
averages = average(result , SIZE );
cout << " Sum = "<<result <<endl;
cout << " Average = "<<averages<<endl;
}
int sum(int num[] , int size)
{
int result = 0;
for(int i = 0; i < size; i++)
{
result = result + num[i];
}
return result ;
}
int average(int result , int size)
{
int average = result / size;
return average;
}
-) don't post direct solutions for problems (at least not for people learning the language). Teach someone to fish rather than giving them a fish, etc.
-) ashleykathy needs to stop posting every homework assignment she gets on this forum. This isn't a homework service.