Question: Using a trace table, trace the following pseudocodes and display the outputs. If there is an issue you can stop the trace table where the
Using a trace table, trace the following pseudocodes and display the outputs. If there is an issue you can stop the trace table where the issue starts to affect the program and state under the trace table what the problem is and how it can be fixed.
Problem 1:
1: Start
2: n = 2839
3: sum = 0
4: iteration = 0
5: While (n > 0) Do
6: digit = n % 10
7: sum = sum + digit
8: n = n / 10
9: iteration = iteration +1
10: End While
11: Print (sum, )
12: Print (iteration)
13: End
Problem 2: (Hint: has a problem)
1: Start
2: n = 2839
3: sum = 0
4: iteration = 0
5: While (n >= 0) Do
6: digit = n % 10
7: sum = sum + digit
8: n = n / 10
9: iteration = iteration +1
10: Print (iteration, )
11: End While
12: Print (sum )
13: End
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
