For the numbers 1
through 1000
-
if the number is divisible by
5
printIron
-
if the number is divisible by
7
, printYard
-
if it is divisible by both
5
and7
, printIronYard
-
that is:
1
2
3
4
Iron
5
6
Yard
.
.
.
For the numbers 1
through 1000
if the number is divisible by 5
print Iron
if the number is divisible by 7
, print Yard
if it is divisible by both 5
and 7
, print IronYard
that is:
1
2
3
4
Iron
5
6
Yard
.
.
.
Given an array, create a new array that has all of the elements of the first array but in reverse order.
[5,4,9,1,2]
return [2,1,9,4,5]
Write a method that given an array of strings, returns an array containing only the strings that are palindromes.
["foo", "bar", "bazab", "Gavin", "barrab", "test"]
, returns only ["bazab", "barrab"]
Write a method that given a number returns the sum of the digits of that number
1572
, returns 15
Write a method to find all the numbers between 2
and 1000
that are squares
4, 16, 25, ...