Question

Its known that if you add the digits of any number, and that it eventually equals nine, that the original number is divisibl
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#source code:

def div_9(n):
   if(n%9==0):
       return True
   else:
       return False
x=[99,0,18273645,22]
for i in x:
   print(div_9(i))
  

def div 9 (n) if (nt9--0) C: \Users\vishnu\Desktop\output\rm>python mid.py True True True False return True else return False

#if you have any doubts comment below...

Add a comment
Know the answer?
Add Answer to:
It's known that if you add the digits of any number, and that it eventually equals...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Divisibility by 9 To determine if a number is evenly divisible by 9, simply add all...

    Divisibility by 9 To determine if a number is evenly divisible by 9, simply add all of the digits in that number. If the sum is divisible by 9, then the original number also is divisible by 9. For example, notice that all of the multiples of 9 from 1 through 12 (9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, and 108) contain digits which sum to 9 or 18 in every case. In another example, to...

  • Write java program to check that a (16-digit) credit card number is valid. A valid credit...

    Write java program to check that a (16-digit) credit card number is valid. A valid credit card number will yield a result divisible by 10 when you: Form the sum of all digits. Add to that sum every second digit, starting with the second digit from the right. Then add the number of digits in the second step that are greater than four. The result should be divisible by 10. For example, consider the number 4012 8888 8888 1881. The...

  • Instructions Good news! You have are nearly finished with the semester! Today’s problem is going to...

    Instructions Good news! You have are nearly finished with the semester! Today’s problem is going to be to modify a program to match the actual check used to verify Social Insurance Numbers. Don’t worry, the first part of the solution has been taken care of for you. You just need to modify it to also check the bits in BOLD font. A valid SIN is calculated by multiply odd-positioned digits (1st, 3rd, 5th, 7th, & 9th) by 1 and even-positioned...

  • C++: Write a recursive function that does the following: Given a number, add all the digits...

    C++: Write a recursive function that does the following: Given a number, add all the digits and display the sum. Example:                         The sum of the number 5432 would be 14. PLEASE PAY ATTENTION TO THE FOLLOWING: Do not use the static modifier. No global variables. Your program should implement a non-tail recursive algorithm. In other words, it should do something as it moves towards the base case, the tail, and also do something as it comes back from...

  • Background to this question Functions can return booleans, which is often convenient for hiding complicated tests...

    Background to this question Functions can return booleans, which is often convenient for hiding complicated tests inside functions. For example: def is_divisible(x, y): if x % y == 0: return True else: return False It is common to give boolean functions names that sound like yes/no questions; is_divisible returns either True or False to indicate whether x is divisible by y. Here is an example: >>> is_divisible(6, 4) False >>> is_divisible(6, 3) True The result of the == operator is...

  • Please do both parts (in Java); thanks! An Armstrong number of three digits is an integer...

    Please do both parts (in Java); thanks! An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 3^3 + 7^3 + 1^3 = 371. Draw the flowchart and write a Java code to find ALL Armstrong number in the range of 0 and 999. You should write your code in two ways: (Yes as if you are...

  • Using the C Programming Language: An integer number is said to be a perfect number if...

    Using the C Programming Language: An integer number is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number because 6 = 1 + 2 + 3. Write a function perfect that determines if parameter number is a perfect number. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each...

  • Write an application (SpaceDigits) that: (in java) a. inputs one number consisting of five digits from...

    Write an application (SpaceDigits) that: (in java) a. inputs one number consisting of five digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each. For example, if the user types in the number 42339, the program should print “4 2 3 3 9.” (Hint: The number input is five digits long, dividing it by 10000 gives the leftmost digit. digit1 = number / 10000 ) b. determines...

  • To use the digits function, enter 1 To use the average function, enter 2 To use the perfect sum f...

    use matlab To use the digits function, enter 1 To use the average function, enter 2 To use the perfect sum function, enter3 To exit the program, enter 4 Please select a number = 6 Please re-select again: 2 please enter the first number 3 please enter the second number: 6 please enter the third number: 3 The average equals to: 4 Write a function, called digits function that is able to calculate the number of digits and the summation...

  • Consider the following program that reads students’ test scores into an array and prints the contents of the array. You will add more functions to the program. The instructions are given below.

    Consider the following program that reads students’ test scores into an array and prints the contents of the array.   You will add more functions to the program.  The instructions are given below.              For each of the following exercises, write a function and make the appropriate function call in main.Comments are to be added in the program. 1.       Write a void function to find the average test score for each student and store in an array studentAvgs. void AverageScores( const int scores[][MAX_TESTS],                       int...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT