Computer Science, asked by Prajjawaljhamicrosof, 11 months ago

Write a program to input two number And display their cube.(java)

Answers

Answered by nishthav
0

Import java.util.Scanner

Public class cube

{

Public static void main()

{

Ob Scanner=new Scanner(System.in)

Int s,c

s=ob.nextInt()

c=Ob.nextint()

F=s*s*s

G=c*c*c

System.out.println(“enter first no”+s)

System.out.println(“the cube is”+f)

System.out.println(“enter second no”+c)

System.out.println(“the cube is “+g)

Note:

Guys this is d code but u hav to add capital letters wherever required and don’t forget the semicolon at the last

Cheers

Hope it’s right

If it is plzzz mark as brainliest

Answered by stylishtamilachee
1

Answer:

import java.util.Scanner ;

public class power

{

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)) ;

}

}

Example output:

Enter first integer number: 8

Enter second integer number: 27

Cube of 8 is: 512.0

Cube of 27 is: 19683.0

The Math.pow method returns first argument (called three 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