Q14.Consider the following snippet of code. Assume that `1234` is passed as input to the code. What will be the output?
```
num = int(input("Enter a number"))
s_num = 1
while num != 0:
digit = num % 10
s_num = s_num + digit
num //= 10
print(s_num)
```
Save
Check
Details
Q14
7 Jul 2024
Q14.Consider the following snippet of code. Assume that `1234` is passed as input to the code. What will be the output?
```
num = int(input("Enter a number"))
s_num = 1
while num != 0:
digit = num % 10
s_num = s_num + digit
num //= 10
print(s_num)
```