Divisibility by Three - aloalgo

Divisibility by Three

Very Easy

You are given a non-negative integer n.

Your task is to determine whether n is divisible by three.

You may assume that:

  • n is a non-negative integer.

Return true if n is divisible by three, otherwise return false.

Example 1

Input
9
Output
True
Explanation:

9 divided by 3 is 3 with no remainder, so 9 is divisible by three.

Example 2

Input
10
Output
False
Explanation:

10 divided by 3 is 3 with a remainder of 1, so 10 is not divisible by three.

Example 3

Input
0
Output
True
Explanation:

0 divided by 3 is 0 with no remainder, so 0 is divisible by three.

Loading...
Input
9
Output
True

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!