Skip to content

Instantly share code, notes, and snippets.

@ikyamelia
Created August 12, 2021 05:01

Revisions

  1. ikyamelia created this gist Aug 12, 2021.
    12 changes: 12 additions & 0 deletions prime.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    function PrimeTime(num) {
    for (let i = 2; i < num; i++) {
    if (num % i === 0) {
    return false
    }
    }
    return true;

    }

    // keep this function call here
    console.log(PrimeTime(readline()));
    11 changes: 11 additions & 0 deletions prime.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # Prime Time
    Have the function PrimeTime(num) take the num parameter being passed and return the string true if the parameter is a prime number, otherwise return the string false. The range will be between 1 and 2^16.

    ## Examples
    ```
    Input: 19
    Output: true
    Input: 110
    Output: false
    ```