O número mais brilhante, emocionante e fantástico
Dado um número n, retorne uma frase que descreva o número das seguintes maneiras.
- Sempre comece a string com "The most ".
- Se
nfor divisível por 1 sem deixar resto, adicione "brilliant " à frase. - Se
nfor divisível por 2 sem deixar resto, adicione "exciting " à frase. - ... 3, adicione "fantastic " à frase.
- ... 4, adicione "virtuous " à frase.
- ... 5, adicione "heart-warming " ...
- ... 6, adicione "tear-jerking " ...
- ... 7, adicione "beautiful " ...
- ... 8, adicione "exhilarating " ...
- ... 9, adicione "emotional " ...
- Se
nfor divisível por 10 sem deixar resto, adicione "inspiring " à frase. - Sempre termine a string com "number is
n!".
Exemplos
describeNum(13) ➞ "The most brilliant number is 13!"
// 13 is evenly divisble by 1 only
describeNum(4) ➞ "The most brilliant exciting virtuous number is 4!"
// 4 is evenly divisible by 1, 2 and 4
describeNum(21) ➞ "The most brilliant fantastic beautiful number is 21!"
// 21 is evenly divisible by 1, 3 and 7
describeNum(60) ➞ "The most brilliant exciting fantastic virtuous heart-warming tear-jerking inspiring number is 60!"
// 60 is evenly divisible by 1, 2, 3, 4, 5, 6 and 10Observações
- Adicione as palavras à frase na ordem em que aparecem na lista.
- Lembre-se de adicionar um espaço entre cada palavra.
- BONUS: Tente encontrar o menor número que use todas as palavras possíveis da frase!