So what is a square of a number. In mathematics, a square of a number is the product of a number multiplied by itself. For example square root of 3 is 9 becuase 3 multiplied by itself which is 3 is 9 another example square of 2 is 4 because 2 x 2 = 4.
- Use the
- Use the
1. Finding square of number using Math.pow()
Math.pow() method. This function takes two arguments first one is the number or a value which should be multiplied.
The second argument is number of times we want that number to be multiplied so in our case we want to find the square so it will be 2 so now let’s see this is in code.
2. Finding square of number using Exponentiation
This is another method which we can use to find the square of a number this one is very simple and easy to do we will use exponentiation which looks like this 4 ** 2 this works just like the math.pow() the first number is the number we want to square of.
The second number is how many time it should multiplied by it self which would be 2 times so let’s see how to do this in code.
3. Finding square of a number by multiplying by itself
So this was for today if you want more guides like this and want to stay updated on our latest guides you can join our Telegram channel here – Join Coderzway Telegram Channel.
Thank you for reading, Have a nice day 🙂