Home > Back-end >  Freshman year C language problem, consult!
Freshman year C language problem, consult!

Time:09-23

Excuse me what is the problem that this program, I want to enter a owns 10 number of arrays, and then there was a problem, how to solve this problem,
#include
# define NUMELS 10
Double business (int [], int);
Int main ()
{
Int grades [NUMELS];
int i;
Double business;
for(i=0; i{
Printf (" both please type in the number: \ n ");
The scanf (" % d ", & amp; Grades [NUMELS]);
}
Business=average (grades, NUMELS);
Printf (" % f ", business);

}
Double business (int grades [], int NUMELS)
{
int i;
Double total=0.0;
for(i=0; i{
Total +=grades [I];
}
Return (total/NUMELS);
}

CodePudding user response:

for(i=0; i{
Printf (" both please type in the number: \ n ");
The scanf (" % d ", & amp; Grades [I]);
}

CodePudding user response:

The
reference 1/f, arfi response:
for (I=0; i{
Printf (" both please type in the number: \ n ");
The scanf (" % d ", & amp; Grades [I]);
}

Double business (int grades [], int NUMELS this line there is something wrong with the old said let me in front of the parameter add commas or ellipses what mean

CodePudding user response:

Double business (int grades [], int NUMELS)
The second into, and the macro definition conflict, change the

CodePudding user response:

for(i=0; i{
Printf (" both please type in the number: \ n ");
The scanf (" % d ", & amp; Grades [I]);
}

CodePudding user response:

 
# include & lt; Stdio. H>

# define N 10

Double business (int [], int);

Int main ()
{
Int grades [N].
int i;
Double the result;

for (i=0; i {
Printf (" both please type in the number: ");
The scanf (" % d ", & amp; Grades [I]);
}

Result=average (grades, N);
Printf (" % f \ n ", result);

return 0;
}

Double business (int grades [], int n)
{
int i;
Double total=0.0;
for (i=0; i {
Total +=grades [I];
}
Return (total/n);
}