In general, your program should ask the user for five different test scores, det
ID: 654008 • Letter: I
Question
In general, your program should ask the user for five different test scores, determine which one is the lowest, and calculate and display the average of the remaining four highest scores. The test scores are assumed to be ints. Note that although the test scores in this problem are ints, the average should be calculated as a double. Have it printed out to two decimal places. Notice that this problem includes a requirement to create three different functions besides the main() function. Here are some programming notes for those functions:
1) void getScore()
The getScore() function should include a prompt to enter another test score, an input CS1336
Explanation / Answer
#include<stdio.h>
#include<conio.h>
void getScore(int *a)
{
int i,c;
for(i=0;i<5;i++)
{
printf("Enter no")
scanf("%d",c);
if(c>0 && c<100 )
{
a[i]=c;
}
else
{
i--;
}
}
}
void calcAverage(int *a)
{
int low,i,s=0;
low = findLowest(a);
for(i=0;i<5;i++)
{
if(a[i]!=low)
{
s=s+a[i];
}
}
av=s/5;
printf("Average is %lf",av);
getch();
}
int findLowest(int *a)
{
int i,l=a[0];
for(i=0i<5;i++)
{
if (a[i]<l)
{
l=a[i];
}
}
return l;
}
void main()
{
int a[5],low;
getScore(a);
calcAverage(a);
}