Please explain why is wrong or right Each of the following s
Please explain why is wrong or right
Each of the following segments has a logical error. Circle the error and show how to correct the statement. int loop, sum; loop = 1; sum = 0; while (loop c) coutSolution
Questio 5A:
I dont see any logical error in this block. I think here is that there a syntax error at loop ++;
Space should not be there between loop ++; it should be loop++;
Question 5B:
There is a logial error with if block scope.
it should like this. if condition block scope should be mentioned with curly braces. Otherwise if condition will treat only one first statement is if block statement.
int n;
cin >> n;
if(n > 100) {
cout<<\"good score\";
cout<<n<<\" is above 100\";
}
Question 5c:
there is a logical error with logial operator. we should use && instead of ||.
code should be like this
int a,b,g;;
cin >>a>>b>>c;
if(a > b && a>c)
cout<<\"the largest is \"<<a;

