Question: Consider the code below. a. It contains four errors that prevent it from being properly compiled (syntax errors). For each of these errors identify it

Consider the code below. a. It contains four errors that prevent it from being properly compiled (syntax errors). For each of these errors identify it by indicating the code line and explain how it can be fixed so that the program is successfully compiled. b. Line 9 does not contain any syntax error. However, there is a logical error that will prevent the code from correct execution. What is this error?

1. #include

2.

3. int main( )

4. {

5. char cChoice;

6. int nfact=21;

7.

8. printf("Multiply Menu a:3 b:5 c:9 ");

9. scanf("%d", &cChoice);

10.

11. if( cChoice == 'a' \\ cChoice == 'c')

12. nfact*=3;

13. else (cChoice != 'b')

14. nfact=nfact*5;

15. if (cChoise == 'c')

16. nfact=*3;

17. printf("Result is %s ",nfact);

18.

19. return 0;

20. }

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!