0% found this document useful (0 votes)
11 views2 pages

Set 1 Debug Tutorial

The document presents a tutorial for a problem-solving and algorithmic thinking course, focusing on identifying missing statements in a prime number checking program and correcting logical errors in an algorithm for finding the digital root of a number. It includes two sets of tasks, each worth 5 marks, aimed at enhancing students' understanding of programming concepts. The first task involves completing a prime-checking program, while the second requires debugging a digital root algorithm.

Uploaded by

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

Set 1 Debug Tutorial

The document presents a tutorial for a problem-solving and algorithmic thinking course, focusing on identifying missing statements in a prime number checking program and correcting logical errors in an algorithm for finding the digital root of a number. It includes two sets of tasks, each worth 5 marks, aimed at enhancing students' understanding of programming concepts. The first task involves completing a prime-checking program, while the second requires debugging a digital root algorithm.

Uploaded by

vishwashree1029
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

23CSE108 PROBLEM SOLVING AND ALGORITHMIC THINKING

DEBUG/TUTORIAL-OCTOBER 2025
CIVIL ENGINEERING
SET 1
Total=10 marks

1. Identify the program and Fill in the missing statements with the appropriate one.
[5 marks)]
1️⃣ Start

2️⃣ Declare variables _________________________

3️⃣ Print "Enter a number to check whether prime or not:"

4️⃣ Read num

5️⃣ If (___________________________)
flag = 1

6️⃣ For (i = 2; ______________________; ++i)


a) If (________________________)
flag == 1
Break

7️⃣ If (flag == 0)
Print "Entered number %d is a prime number.", num
Else
Print "Entered number %d is not a prime number.", num

8️⃣ Stop

2. The following algorithm is intended to find the digital root of a number.


However, the algorithm contains logical errors and does not produce the correct
digital root when the sum of digits is greater than 9.

[5 marks]

Step 1:Start
Step 2:Declare n, sum = 0, rem
Step 3:Print "Enter a number:"
Step 4:Read n
Step 5:While n > 0
Step 5.1 rem = n % 10
Step 5.2: sum = sum + rem
Step 5.3: n = n / 10
Step 6:End While
Step7:If sum > 9 then
Step 7.1: Print "Digital root =", sum
Step 8:Else
Step 8.1: Print "Digital root =", sum
Step 9:End If
Step 10:Stop

You might also like