Skip to content

Instantly share code, notes, and snippets.

@cesar
Last active June 26, 2017 22:34
Show Gist options
  • Save cesar/d8fd2521d5f73ef3a69bdea39e8ded86 to your computer and use it in GitHub Desktop.
Save cesar/d8fd2521d5f73ef3a69bdea39e8ded86 to your computer and use it in GitHub Desktop.
  1. Create calculators for the following equations:
    1. BMI
    2. BAC
    3. BMR
  2. Find the sum of all the numbers in an array
  3. Given an array of numbers determine what is the average number of the array
  4. Find the largest number in the array. How would you modify the code to find the smallest number in the array
  5. Given an array of numbers, print to STDOUT how many numbers are negative, how many are positive, and how many are 0
  6. 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.
  7. 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.
  8. 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
  9. 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
  10. Given a string, determine how many vowels are in the string
  11. Given a sentence and a word, determine if the word is inside the sentence
  12. Given a number n, create a piramid with n levels, example:

n = 4

     **
    ****
  ********
************
  1. 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!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment