1)Write a method that takes an array of ints and returns the sum of all numbers that are even. For example, given an array {3, 4, 6}, you would return 10.
1)Write a method that takes an array of ints and returns the sum of all numbers that are even. For example, given an array {3, 4, 6}, you would return 10.
2)For this exercise, you are given an array of integers. Return true if every element in the array is an odd number, otherwise return false.
3)
Given an array of strings, return the array in reverse order.
For example, given:
reverse({"one", "two", "three"});
You would return:
{"three", "two", "one"}
4)
For this exercise, you need to shift all the elements in the array one space to the right (increase the index of the element by 1). The last element will wrap around and become the new first element.
For example, given:
moveUp({"first", "second", "third", "fourth"});
You would return:
{"fourth", "first", "second", "third"}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images