Debug the following C program include int main main int in

Debug the following C program.

#include int main () {/* main */int input_value1, input_value2; int aggregate = 0; printf(\"Input two integers:\ \"); scanf(\"%d %d\", &input;_value1, &input;_value2); printf(\"Before\ \"); if (input_value1 input_value2) {printf(\"First\ \"); aggregate = input_value1 + input_value2;}/* if (input_value1

Solution

Above program will give compile error saying it expects an expression before ||

so if you want your program to be correct you should use below code

if((input_value1 > input_value2)||(input_value2 > input_value1))

Now, considering above line then the debug of the program is :

input two integers

4

5

Before

First

After

aggregate = 9

Debug the following C program. #include int main () {/* main */int input_value1, input_value2; int aggregate = 0; printf(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site