+ 1

What is the code to square of a number

I do not know

12th Feb 2017, 9:49 AM
Shekhar Rajbhar
Shekhar Rajbhar - avatar
4 Respuestas
+ 8
simplest way is to use: x *= x; ,where x is your variable name :D
12th Feb 2017, 10:10 AM
Nikolay Nachev
Nikolay Nachev - avatar
+ 1
Double d = Math.pow(2, 2); //return 4.0 ( the first parameter raised to the power of the second parameter )
12th Feb 2017, 11:02 AM
orsi
0
+1
14th Feb 2017, 12:08 PM
rajeev rv
rajeev rv - avatar
0
import java.util.*; class Square { public static void main (String ar[ ]) { Scanner sc= new scanner (System.in); int num, square; num=sc.nextInt(); square=num*num; System.out.print(square); } }
14th May 2018, 4:17 AM
Shambhavi
Shambhavi - avatar