Ask Question
19 December, 10:44

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.

+5
Answers (1)
  1. 19 December, 13:45
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers