Skip to content

Instantly share code, notes, and snippets.

@panta82
Created December 13, 2017 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save panta82/b5467ea511e68bdfcd501254c3ea9839 to your computer and use it in GitHub Desktop.
Save panta82/b5467ea511e68bdfcd501254c3ea9839 to your computer and use it in GitHub Desktop.
Beginner programming tasks

Beginner programming tasks

1. VR

Write a program that outputs numbers from 1 to 100. Except, for every 3rd number, it should write "V", for every 5th number it should write "R" and for every 15th number it should write "VR".

Example output:

1
2
V
4
R
V
7
8
V
R
11
V
13
14
VR

2. Anagram

Write a function that takes two words as an argument and returns true if they are anagrams (contain the exact same letters) and false otherwise.

Example usage:

isAnagram('abc', 'bac'); // true
isAnagram('abc', 'abcc'); // false
isAnagram('abd', 'dba'); // false

3. Multiply

Write a function that performs multiplication without using the native "*" operator.

Example usage:

multiply(3, 5); // 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment