Square a number: awful answers only
Matt Ellen-Tsivintzeli
Posted on November 13, 2020
Today's challenge is deceptively simple. Square a number. Given the input of an integer, output that integer multiplied by itself.
E.g.
square(3);
//output: 9
square(15);
//output: 225
Of course, I only want to see the worst ways to do this. Don't hold back. Make the compiler beg for mercy! You might find inspiration in the Wikipedia article on squaring.
Tests
square(4) == 16;
square(16) == 256;
square(51) == 2601;
💖 💪 🙅 🚩
Matt Ellen-Tsivintzeli
Posted on November 13, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.