#CCBCHMOT0000009. While không thực hiện lượt nào (Zero-Iteration While Loop)
While không thực hiện lượt nào (Zero-Iteration While Loop)
Zero-Iteration While Loop
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Initialize x=0. While x<n, increase x by one. Print the final x. This task highlights that a while loop may execute zero times.
Input
One integer n.
Output
Print the final value of x.
Subtasks
- Subtask 1 (20%): 0 <= n <= 5.
- Subtask 2 (30%): 0 <= n <= 50.
- Subtask 3 (50%): 0 <= n <= 100.
Examples
Example 1
Input
0
Output
0
Explanation
The initial condition 0<0 is false, so x remains zero.
Example 2
Input
3
Output
3
Explanation
The loop increments x from 0 to 3, then stops.