Question: C Programming ERROR The following code gives me this problem. Picture and code is below. The first set of inputs shows an output 6.75 ...
C Programming ERROR
The following code gives me this problem. Picture and code is below.
The first set of inputs shows an output "6.75" ... two decimal places Which is correct. The next set of inputs Zybooks uses shows that it SHOULD be "4" with NO decimal places. My second result is wrong because it prints "4.00". The computer seems to want an exact decimal output for each specific output. I have been told this is not possible, but this grading system says that it is.
Please reply only if you have an answer other than "it is not possible"
Picutre of error and code is pasted below! Thanks in advance!
printf(" The minimum value is %d, the maximum value is %d, and the average value is %.2f. ",low,high,mean); Look for this code at very bottom
ALSO the code does not recoginze negative inputs.

#include
int checkString(char c[]) { int i,num=0; for(i=0;i do{ if(i!=0) printf("INPUT ERROR! "); if(flag==0) printf("How many values are to be entered?: "); else printf("Value %d: ",flag); char c[100]; scanf("%s",&c); num=checkString(c); i++; }while(num==-1); return num; } int main() { float mean; int high,low; printf("MIN,MAX, and MEAN CALCULATOR "); int i,num=inputNum(0); for(i=0;i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
