Skip to content

Latest commit

 

History

History

08. Functions

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Functions

Problem 1. English digit

  • Write a function that returns the last digit of given integer as an English word.

Examples:

input output
512 two
1024 four
12309 nine

Problem 2. Reverse number

  • Write a function that reverses the digits of given decimal number.

Example:

input output
256 652
123.45 54.321

Problem 3. Occurrences of word

  • Write a function that finds all the occurrences of word in a text.
  • The search can be case sensitive or case insensitive.
  • Use function overloading.

Problem 4. Number of elements

  • Write a function to count the number of div elements on the web page

Problem 5. Appearance count

  • Write a function that counts how many times given number appears in given array.
  • Write a test function to check if the function is working correctly.

Problem 6. Larger than neighbours

  • Write a function that checks if the element at given position in given array of integers is bigger than its two neighbours (when such exist).

Problem 7. First larger than neighbours

  • Write a function that returns the index of the first element in array that is larger than its neighbours or -1, if there’s no such element.
  • Use the function from the previous exercise.