Some numbers are formed with closed paths. the digits 0, 4, 6 and 9 each have 1 closed path and 8 has 2. None of the other numbe rs is formed with a closed path. Given a number determine the total number of closed paths in each of its digits combined.
1 answer:
Answer:
def cal(n):
s=0
while n>0:
r=n%10
if(r==0 or r==4 or r==6 or r==9):
s=s+1
elif r==8:
s=s+2
n=n//10
print(s)
n=int(input("enter number:"))
print(n)
cal(n)
Explanation:
Create a function to calculate count of closed path
. Create a variable to store count of closed path
. While number is positive
, extract last digit of n
. Reduce number by truncating last digit
. Make a function call to compute count of path.
You might be interested in
The most serious security threat to Bluetooth-enabled devices is , which occurs when a hacker gains access to the device and its functions without the owner's consent.
Answer:
Webpage Layouts where finally designed using html code
Explanation:
Answer: ......
Explanation: yes