Computer Science, asked by thakurprashant5481, 1 year ago

Write a program to input two number and display their cube . (Java)

Answers

Answered by pchourasia1405
0

Answer:

Refer to the attachment for the answer.

Please mark me BRAINLIEST.

Attachments:
Answered by stylishtamilachee
2

import java.util.Scanner;

public class powerRoots

{

void compute( )

{

Scanner sc=new Scanner(System.in) ;

int num1, num2;

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

num1=sc.nextInt( );

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

num2=sc.nextInt( );

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

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

}

}

Explanation:

  • The Math.pow method returns first argument (called the base number) raised to power of second-argument (called the exponent).
  • That is, return value of Math.pow( X,Y ) is X^y
Similar questions