InterviewBit Academy is now Scaler!
InterviewBit Academy is now Scaler Academy!

Check divisibility by 7

Problem Description

You are given a large number denoted by a string A, check if it is divisible by 7.

NOTE: You are not allowed to use modulo(%) operator.



Problem Constraints

1 <= |A| <= 105

String will not contain any leading zeros.



Input Format

First and only argument is a string A denoting the number.



Output Format

Return an integer 1 if A is divisible by 7, else return 0.



Example Input

Input 1:

 A = "35"

Input 2:

 A = "3"



Example Output

Output 1:

 1

Output 2:

 0



Example Explanation

Output 1:

 Since 35 is divisible by 7, Return 1.

Output 2:

 Since 3 is not divisible by 7, Return 0.



NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Check divisibility by 7 on Interview Code Editor
Sign Up
to access hints and editorial solutions for Check divisibility by 7

Discussion


Loading...
Click here to start solving coding interview questions