Question: C code Consider the following program. It compiles without any compile-time errors in GCC, yet it contains a total of 4 issues (a combination of
C code
Consider the following program. It compiles without any compile-time errors in GCC, yet it contains a total of 4 issues (a combination of contextual, syntax, and logical problems). Study the program to identify all the issues. For each issue, list its type (syntactic, contextual, semantic), what the problem is, and how to fix it.
#include
int main() {
int input;
int result;
printf("Enter an integer number: ");
scanf("d", input);
result = input % 2;
if (result = 0)
printf(" Number %d is even.", input);
else if (result != 0)
printf(" Number %d is odd.", input);
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
