Ask Question
14 November, 18:38

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 numbers is formed with a closed path. Given a number determine the total number of closed paths in each of its digits combined.

+4
Answers (1)
  1. 14 November, 22:18
    0
    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.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “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 numbers is ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers