Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Problem No 7

Check Divisible by Three

Easy

6 minute session

Summary

Determine whether a given integer is divisible by 3.

Problem statement

Given an integer n, return True if n is divisible by 3, otherwise return False. Zero is considered divisible by 3. The function should accept negative integers as well.

Task

Write a function that returns True if an integer is divisible by 3, otherwise False.

Examples

Example

Input

9

Output

True

Explanation

9 % 3 == 0, so 9 is divisible by 3.

Input format

A single integer n.

Output format

A boolean: True if n is divisible by 3, otherwise False.

Constraints

-10**9 <= n <= 10**9 (typical integer range). Only integers will be provided.

Samples

Sample input 0

10

Sample output 0

False

Explanation 0

10 is not divisible by 3.

Code editor
Loading editor…

AI assistant

Ask me anything!

Need help? I can explain the core idea behind this problem, review your current code, and give targeted hints. Use “Teach Theory” for the concept, “Get AI hint” for a quick scaffold nudge, or ask a specific question below.

Chat history is temporary and will not be saved.

03:49 AM

Free preview includes 1 Teach Theory response and 1 AI hint per unlocked preview lesson.