Computer Science, asked by debadyutidey4, 9 months ago

Write a program to input a number. Calculate its square root and cube root. Finally display

the result by rounding it off​

Answers

Answered by LakshmiSirishma
21

Explanation:

import java.util.*;

/*Java Program to find square, square root and cube of a given number*/

public class j5

{

public static void main(String args[]){

Scanner sc=new Scanner(System.in);

int num;

System.out.print("Enter an integer number: ");

num=sc.nextInt();

System.out.println("Square of "+ num + " is: "+ Math.pow(num, 2));

System.out.println("Cube of "+ num + " is: "+ Math.pow(num, 3));

System.out.println("Square Root of "+ num + " is: "+ Math.sqrt(num));

}

}

output:

Enter an integer number: 12

Square of 12 is: 144.0

Cube of 12 is: 1728.0

Square Root of 12 is: 3.4641016151377544

Answered by sg463458
6

Answer:

import java.util.*;

class_square

public static void main (String args [ ] )

{

Scanner sc=new Scanner(System.in);

{

System.out.println("Enter the number");

int a=(next Int);

System.out.println("The square of the number is:"+a²);

}

}

Explanation:

Please mark me brainliest.

Similar questions