Question: Debug the following code. When it runs, it prints out That is NOT correct! no matter what the user enters. Why is this occurring and

Debug the following code. When it runs, it prints out "That is NOT correct!" no matter what the user enters. Why is this occurring and how do you fix it:

#include

int main (int argc, char* argv { } )

{

int a=42, b-42;

int answer;

print ("What is %d-%d ", a, b);

scanf ("%d", &answer);

if (answer=0)

{

printf ("That is correct! ");

}

else

{

printf ("That is NOT correct!");

}

return 0;

}

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!