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.

C Programming ERROR The following code gives me this problem. Picture and

#include

int checkString(char c[]) { int i,num=0; for(i=0;i=48&&c[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;ivar) low=var; } mean=mean+(float)var; } mean=mean/(float)num; printf(" The minimum value is %d, the maximum value is %d, and the average value is %.2f. ",low,high,mean); return 0; }

1: Compare output 10/10 2 npt as 17 Your output correctly himum value is 2, the maximum value is 17, and the average value is 6.75 ends with 2: Compare output 0/10 Output differs. See highlights below. Input 2 Your output ends inimum value is 2, the maximum value is 6, and the average value is 4.00 Expected output minimum value is 2, the maximum value is 6, and the average value is 4. ends with 3:Compare output 0/10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!