5.calculate square and cube
class square_cube
{
public static void main(String arg[])
{
int a = Integer.parseInt(arg[0]); // convert string to integer
int sq, cu;
sq = a * a;
cu = a * a * a;
System.out.println("Square = " + sq);
System.out.println("Cube = " + cu);
}
}
Comments
Post a Comment