about | help | code help+videos | done | prefs |
colorNumber
Given a number between 1 and 100, return a string containing the color of the number. The color of a number is determined by the following rules. A color is "Red" if it is divisible only by 3 and not by 5. A number is "Yellow" if it is divisible by 5 and not by 3. A number is "Orange" if it divisible by both 3 and 5, and is "Black" if it is not divisible by either 3 or 5. (Credit to Oren). colorNumber(2) → "Black" colorNumber(6) → "Red" colorNumber(10) → "Yellow" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 100
Copyright Nick Parlante 2017 - privacy