DEV Community

LATOYA FOWLER
LATOYA FOWLER

Posted on

Algorithm practice

https://codepen.io/ldfowler/pen/qBjOOvV

// // 1.) Write a function that returns an array with all the numbers from 1 to 255.
// function ReturnArrayFromOneTo255()
12:07
//2.) Write a function that would get the sum of all the even numbers from 1 to 1000.
//3.) Write a function that returns the sum of all the odd numbers from 1 to 5000.
// 4.) Write a function that returns the sum of all the values within an array.
// (e.g. [1,2,5] returns 8, [-5,2,5,12] returns 14).
// 5.) Given an array with multiple values,
// write a function that returns the maximum number in the array.
// 6.) Given an array with multiple values,
// write a function that returns the average of the values in the array.
// [1,3,5,7,20] average is 7.2
// 7.) Write a function that would return an array of all the odd numbers between 1 to 50.

Top comments (0)