Divisibility by 999
Submissions: 801   Accuracy:

40.67%

  Difficulty: Easy   Marks: 2

You are given an n-digit large number, you have to check whether it is divisible by 999 without dividing or finding modulo of number by 999.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an string denoting the number.

Output:
Print "Divisible" (without quotes) if the number is divisible by 999.
Print "Not divisible" (without quotes) if the number is not divisible by 999.

Constraints:
1<=T<=10^5
1<=length of string<=10^9

Example:
Input:

2
1998
999999999

Output:
Divisible
Not divisible

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil
Author: Ayush Govil 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.