Question: Question 2 1 pts The following program supposes to sum all entered int values that are greater than 5. It takes integer input and -1

 Question 2 1 pts The following program supposes to sum all

Question 2 1 pts The following program supposes to sum all entered int values that are greater than 5. It takes integer input and -1 indicates the end of input. It compiles without any error message, and it executes without error message, but nevertheless is wrong. What is wrong with the program? #include int main() int x, sum = 0; while (x != -1) scanf("%d",&x); if (x > 5); sum = sum +x; printf("The sum of values > 5 is %d ", sum); . The semicolon at the end of the if statement causes all entered values to be summed. The semicolon at the end of the if statement is an error that the compiler should catch. The while loop does not terminate when input is -1. The while header needs a semicolon at the end of its line

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!