Check if a number is divisible by 8
Submissions: 5394   Accuracy:

24.65%

  Difficulty: Easy   Marks: 2

Given a number n, check if it is divisible by 8.

Input:
The first line of the input contains an integer T denoting the number of test cases. For each test case, there is an integer whose divisibility we need to check. 

Output:
For each test case, the output is 1 if the number is divisible by 8 else -1.

Constraints:
1<=T<=100

1<=digits in n<1000

Example:
Input:

2
16
15
Output:
1
-1

 

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

Contributor: Vanshika
Author: Vanshika_pec


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.