Hi! I turned in my program to my professor, but he said that there was improper line spacing & that my program gave the wrong answer for square root of the average.

If anyone could kindly look at what I have so far & tell me what's wrong with my program, I would greatly appreciate it.

Thank You Very Much.

ASSIGNMENT 2

Write a program which asks the user to enter three numbers from the keyboard, and determines the smallest number, the largest number and (if the sum of all the numbers is not negative) the square root of the sum of all the numbers. If the sum is negative, the program informs the user of that fact.

The program must work for cases in which all data are negative, all data are positive, all data are the same, or the data are mixed negative and positive values.

Here's My Program

Code:#include <stdio.h> #include <math.h> /*This program is designed to find the smallest of 3 numbers, the largest, the average, & the square root of the average.*/ int main() { float a; /*a represents 1st number input.*/ float b; /*b represents 2nd number input.*/ float c; /*c represents 3rd numer input.*/ float avg; /*avg represents the average of those inputs.*/ printf("Please Enter a number. "); scanf("%f",&a); printf("Enter another number. "); scanf("%f",&b); printf("Enter another number. "); scanf("%f",&c); /*This section of the program determines the smallest of the three inputs.*/ if((a<b) && (a<c)) { printf("%f is the smallest number.\n", a); } if((b<a) && (b<c)) { printf("%f is the smallest number.\n", b); } else if((c<a) && (c<b)) { printf("%f is the smallest number.\n", c); } /*This section of the program determines the largest of the three inputs.*/ if((a>b) && (a>c)) { printf("%f is the largest number.\n", a); } else if((b>a) && (b>c)) { printf("%f is the largest number.\n", b); } else if((c>a) && (c>b)) { printf("%f is the largest number.\n", c); } /*This section is in the event the sum of all three numbers are negative.*/ if((a+b+c)<0) { printf("The sum is negative.\n"); printf("You can't find the square root of a negative number!\n"); } /*This section of the program determines the average of the three inputs.*/ avg= (a+b+c)/3; printf("The average of the three numbers is %f\n", avg); printf("The square root of the average is %f\n", sqrt(a+b+c)); return(0); } /*End of Program*/