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
Get step-by-step solutions from verified subject matter experts
