- Create calculators for the following equations:
- Find the sum of all the numbers in an array
- Given an array of numbers determine what is the average number of the array
- Find the largest number in the array. How would you modify the code to find the smallest number in the array
- Given an array of numbers, print to STDOUT how many numbers are negative, how many are positive, and how many are 0
- Given an array of items (they can be numbers) and two index positions, if the positions are valid, swap the two items in the array and return a new copy of the array.
- Given an array of numbers, arrange in ascending fashion (sort them) the smallest element should be in the left-most side of the array and the biggest element should be in the right-most side of the array. Don't use any STDLIB function for sorting.
- Given a positive number, determine if this number is a prime number or not. Remember, prime numbers are numbers that are only divisible by one or the number itself
- Using the isPrime function, create a function that given a number, will return an array of all the primes up to and containing the given number
- Given a string, determine how many vowels are in the string
- Given a sentence and a word, determine if the word is inside the sentence
- Given a number n, create a piramid with n levels, example:
n = 4
**
****
********
************
- A script that reads text from a file (data.txt), reads all the text and replaces words that are in all caps to lower case and outputs the contents to another file. If an all caps word is at the beginning of a sentence, capitalize the first letter of the word. Example:
//data.txt
This is a SAMPLE piece of text.
There is really NOTHING we can do about a person screaming.
EXCEPT maybe call for help!
Convert to:
//output.txt
This is a sampl piece of text.
There is really nothing we can do about a person screaming.
Except maybe call for help!