+ 1
What is the code to square of a number
I do not know
4 Respuestas
+ 8
simplest way is to use:
x *= x;
,where x is your variable name :D
+ 1
Double d = Math.pow(2, 2); //return 4.0
( the first parameter raised to the power of the second parameter )
0
+1
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);
}
}