Index « Previous Next »

Question

There are a number of syntax errors in the following program. Fix the errors and run the program.

*/ What's wrong with this program? /*
#include stdio.h

int main();
}
int a, b, c \* Three integers */
a = 3
b = 4
c = a + b
printf("The value of c is %d" + C);
return 0;
}

Corrected Code

/* What's wrong with this program? */

#include <stdio.h>

int main()
{
    int a, b, c; /* Three integers */
    a = 3;
    b = 4;
    c = a + b;
    printf("The value of c is %d", c);
    return 0;
}