the first output pattern of the code is
1:
[3spaces] ***
[2spaces] **
[1space] *
and
2: if input is [20 or 34 or any double digit like 87] then it should be 8+7 = 15 and 1+5 = 6 this type number reduction
n = 3
x = 2
found = True
while found:
print('#', '#', sep=' '*n)
for k in range(3, 1,-1):
if (x + 1) % k == 0:
found = False
break
n -= 1
f *= x
Number 2:
x = input("Enter a number: ")
res = 0
for i in x:
res += int(i)
print(res)
Comments
Leave a comment