TORONTO KIDS COMPUTER CLUB | PMCA Friday 19:00 Python Homework 21.01.22.
18974

# PMCA Friday 19:00 Python Homework 21.01.22.

## 25 Jan PMCA Friday 19:00 Python Homework 21.01.22.

Question:
Write a program which accepts as input a positive integer and checks, using the algorithm described below, to see whether or not the integer is divisible by 11. This particular test for divisibility by 11 was given in 1897 by Charles L. Dodgson (Lewis Carroll).

Algorithm:
As long as the number being tested has more than two digits, form a new number by:
deleting the units digit
subtracting the deleted digit from the shortened number
The remaining number is divisible by 11 if and only if the original number is divisible by 11.
Note:
Leading zeroes are not considered part of the number and should not be printed.
As usual, the first number in the input indicates the number of positive integers that follow. Each positive integer has a maximum of 50 digits. You may assume no leading zeroes exist in the positive integers.

For each positive integer in the input, the output consists of a series of numbers formed as a digit is deleted and subtracted, followed by a message indicating whether or not the original number is divisible by 11. Outputs for different positive integers are separated by blank lines.

`Sample Input21234567890123456790010Sample Output12345678901234567900123456789012345679012345678901234567912345678901234558123456789012344712345678901233712345678901226123456789011612345678900512345678895123456788412345678412345674123456312345312342123212111The number 12345678901234567900 is divisible by 11.10The number 10 is not divisible by 11.`