✨ Here is a solution for the #challenge above
💬 Personally, I like the first solution more, it is much more expressive!
💬 Personally, I like the first solution more, it is much more expressive!
#challenge
💻 Check if a Number is Prime | #easy
Create a function that returns
The first ten prime numbers are:
🏆 Leave your solutions in the comments. The solution will be posted below in a couple of hours 👇
#interview
💻 Check if a Number is Prime | #easy
Create a function that returns
true
if a number is prime, and false
otherwise. A prime number is any positive integer that is evenly divisible by only two divisors: 1 and itself.The first ten prime numbers are:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29
Examples:isPrime(31) ➞ trueFor your convenience: dotnetfiddle.
isPrime(18) ➞ false
isPrime(11) ➞ true
🏆 Leave your solutions in the comments. The solution will be posted below in a couple of hours 👇
#interview
#challenge
💻 Capitalize the First Letter of Each Word | #easy
Create a function that takes a string as an argument and converts the first character of each word to uppercase. Return the newly formatted string.
Examples:
🏆 Leave your solutions in the comments. The solution will be posted below in a couple of hours 👇
#interview
💻 Capitalize the First Letter of Each Word | #easy
Create a function that takes a string as an argument and converts the first character of each word to uppercase. Return the newly formatted string.
Examples:
MakeTitle("This is a title") ➞ "This Is A Title"For your convenience: dotnetfiddle.
MakeTitle("capitalize every word") ➞ "Capitalize Every Word"
MakeTitle("I Like Pizza") ➞ "I Like Pizza"
MakeTitle("PIZZA PIZZA PIZZA") ➞ "PIZZA PIZZA PIZZA"
🏆 Leave your solutions in the comments. The solution will be posted below in a couple of hours 👇
#interview
#challenge
💻 Perfect Number | #easy
Create a function that tests whether or not an integer is a perfect number. A perfect number is a number that can be written as the sum of its factors, (equal to sum of its proper divisors) excluding the number itself.
For example, 6 is a perfect number, since 1 + 2 + 3 = 6, where 1, 2, and 3 are all factors of 6. Similarly, 28 is a perfect number, since 1 + 2 + 4 + 7 + 14 = 28.
Examples:
#interview
💻 Perfect Number | #easy
Create a function that tests whether or not an integer is a perfect number. A perfect number is a number that can be written as the sum of its factors, (equal to sum of its proper divisors) excluding the number itself.
For example, 6 is a perfect number, since 1 + 2 + 3 = 6, where 1, 2, and 3 are all factors of 6. Similarly, 28 is a perfect number, since 1 + 2 + 4 + 7 + 14 = 28.
Examples:
CheckPerfect(6) ➞ true🏆 Leave your solutions in the comments. The solution will be posted below in a couple of hours 👇
CheckPerfect(28) ➞ true
CheckPerfect(496) ➞ true
CheckPerfect(12) ➞ false
CheckPerfect(97) ➞ false
#interview