X

DAYS

:

HOUR

:

MINS

:

SEC

Copied to Clipboard
Check if divisible by 4
Basic Accuracy: 78.84% Submissions: 3179 Points: 1

Given a number N. Check whether it is divisble by 4.

Example 1:

Input:
N = 1124
Output: 1
Explanation: The number is divisible by 4
as 1124 % 4 = 0.

​Example 2:

Input: 
N = 7
Output: 0
Explanation: The number is not divisibly by
4 as 7 % 4 = 3.


Your Task:
You don't need to read input or print anything. Your task is to complete the function divisibleBy4() which takes the number in the form of a string N as input and returns 1 if the number is divisible by 4. Else, it returns 0.


Expected Time Complexity: O(1).
Expected Auxiliary Space: O(1).


Constraints:
1 <= N <= 101000+5

 

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.


to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Check if divisible by 4

Output Window