### 1996 Canadian Computing Competition, Stage 1

## Problem B: Divisibility by 11

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

- 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 Input

1 12345678901234567900

### Sample Output

12345678901234567900 1234567890123456790 123456789012345679 12345678901234558 1234567890123447 123456789012337 12345678901226 1234567890116 123456789005 12345678895 1234567884 123456784 12345674 1234563 123453 12342 1232 121 11 The number 12345678901234567900 is divisible by 11.

All Submissions

Best Solutions

**Point Value:** 5

**Time Limit:** 2.00s

**Memory Limit:** 16M

**Added:** Sep 28, 2008

**Problem Types:**[Show]

**Languages Allowed:**

C++03, PAS, C, ASM, C#, C++11

## Comments (Search)

Ray7313on Sep 13, 2015 - 9:12:10 pm UTCjargonon Sep 16, 2015 - 7:37:14 pm UTC Re: ...If you'd like more specific help, consider making your indentation consistent so others can read it.

Sroton Jan 18, 2012 - 10:51:32 pm UTC Java?jargonon Jan 18, 2012 - 11:06:45 pm UTC Re: Java?zx_kevin168on Nov 09, 2011 - 10:34:39 pm UTC Python?bbi5291on Nov 09, 2011 - 11:11:58 pm UTC Re: Python?ilovepion Feb 08, 2011 - 3:19:11 am UTC ???SourSpinachon Feb 08, 2011 - 3:20:36 am UTC Re: ???zhxl0903on Dec 26, 2008 - 1:01:42 am UTC I think something's wrong...I don't think the number has to be more than 2 digits, because 22, 33, etc. are all divisible by 11. Am I right?

bleung91on Dec 26, 2008 - 1:12:14 am UTC Re: I think something's wrong...