Count rotations divisible by 4
Submissions: 727   Accuracy:

22.16%

  Difficulty: Basic   Marks: 1

Given a large positive number N having x digits, the task is to count all rotations of the given number which are divisible by 4.

Examples:

Input: 8
Output: 1

Input: 20
Output: 1
Rotation: 20 is divisible by 4
          02 is not divisible by 4


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

Output:
For each test case in a new line print the count of all rotations of N which are divisible by 4.

Constraints:
1<=T<=100
1<=x<=10^5

Example:
Input:

2
8
20
Output:
1
1

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

Author: Shubham Joshi 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.