We are asked to find the output of two pseudo code snippets. The first one is a simple loop that prints the value of $n$ and decrements it. The second one involves updating variables $m$ and $n$, comparing them and printing one of them.
2025/4/21
1. Problem Description
We are asked to find the output of two pseudo code snippets. The first one is a simple loop that prints the value of and decrements it. The second one involves updating variables and , comparing them and printing one of them.
2. Solution Steps
Problem 33:
The loop `forn = 3 tol do` means the loop iterates from 3 down to
1. Inside the loop, we print the value of $n$, then decrement it: $n = n - 1$.
Iteration 1: . Print (3). becomes .
Iteration 2: . Print (2). becomes .
Iteration 3: . Print (1). becomes .
The loop stops because is now less than
1. The output is 3 2
1.
Problem 34:
We have and .
, so .
, so .
, so .
The condition is `if (m>n)`. Since , the condition is true.
We print , which is
1
5.
3. Final Answer
Problem 33: (2) 3 2 1
Problem 34: (4) 15