Question: The ' C ' code below contains some errors. Some of the errors are incorrectly typed code; others are due to code that has been

The ' C ' code below contains some errors. Some of the errors are incorrectly typed code; others are due to code that has been omitted. Some will be detected by the compiler and others will cause the program behaviour to be different from the intended behaviour. Line numbers have been added to the listing. Identify all errors and, for each error: (a) explain what is wrong; (b) state whether the compiler will detect the error; (c) state clearly how the error should be corrected. 1. / Program to calculate parallel value 2. of 2 resistors */ 3. int calc_parallel (float res1,float res2); 4. int main(void) 5. 1 6. float r1;r2; 7. printf("Please enter the values of two resistors: "); 8. scanf("%f",&r1,&r2); 9. parallel = calc_parallel (r1,r2); 10. printf("The parallel value is: of ohms , parallel); 11. retrun 0 ; 12.} 13. float calc_parallel(float res1,float res2); 14. 1 15. float p; 16. p= (res 1res2)/ res 1+ res 2 ; 17. }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
