The following code has 5 different errors. The errors can be any of three types,
ID: 3691561 • Letter: T
Question
The following code has 5 different errors. The errors can be any of three types, i.e., compile (compile-time and syntax errors), execution (run-time errors), or logic errors. There may be more than one error of the same type. A line may contain more than one error. Find and correct the errors in the code, i.e., write the incorrect line(s) and the same line(s) as corrected. Assume that the proper required header files have been included. Write the line(s) containing the 1^st error and correct the line(s). Write the line(s) containing the 2^nd error and correct the line(s). Write the line(s) containing the 3rd error and correct the line(s) Write the line(s) containing the 4^th error and correct the line(s) Write the line(s) containing the 5^th error and correct the line(s).Explanation / Answer
Programme to exchange the values in two mamory loations.
#include <stdio.h>
int main()
{
double a , b , c; //we have to end with the statement with ";"
printf("enter the value of x and y ");
scanf("%d%d", &x, &y);
printf("Before swaping x=%d y=%d ", x , y);
/* for swaping two varibles we should store one value in third variable.because ,if you exchange two values directly one value an erase. */
c = a;
a = b;
b = c;
printf("After swaping x=%d y=%d ", x , y);
/* at the end of main method there should be a return statement */
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.