Find the Error in the Following Code
Find the Error in the Following Code
Find the error in the following code, if any, and identify the output:
2. Find errors in the following code(if any) and correct the code by rewriting it and
underlining corrections.
for in range[0,11]:
if x=y
print x+y
else:
print x-y
3. Find errors in the following code(if any) and correct the code by rewriting it and
underlining corrections.
#include <iostream>
using namespace std;
int main() \\
{ \\
// define the A arrary and initialize it \\
bool A[100]; \\
A[0] = 0; \\
A[1] = 0; \\
for (int i = 2; i < 100; i++) \\
A[i] = 1; \\
// start from every i \\
for (int i = 2; i < 100; i++) \\
{ \\
// set every A[j](where j % i == 0) 0 \\
for (int j = i * 2; j < 100; j += i) \\
{ \\
A[j] = 0; \\
} \\
} \\
return 0; \\
}