0% found this document useful (0 votes)
3 views

Find the Error in the Following Code

The document presents three coding tasks that involve identifying and correcting errors in Python and C++ code snippets. The first task requires finding errors in a Python code snippet that takes user input and performs arithmetic operations. The second task involves correcting a C++ program that initializes an array and implements a sieve algorithm but contains syntax and logical errors.

Uploaded by

Sayan Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Find the Error in the Following Code

The document presents three coding tasks that involve identifying and correcting errors in Python and C++ code snippets. The first task requires finding errors in a Python code snippet that takes user input and performs arithmetic operations. The second task involves correcting a C++ program that initializes an array and implements a sieve algorithm but contains syntax and logical errors.

Uploaded by

Sayan Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

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.

x= int (“Enter value for x))

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; \\
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy