Computer Science, asked by vaishnavipm4488, 5 months ago

Write a program to enter two unequal numbers. If the first number is greater then
display square of the smaller number and cube of the greater number otherwise, viceversa in JAVA.

Answers

Answered by VivekSinghBanger
2

class Freefire

{private int a1=0, a2=0;

public void accept(int a1, int a2)

{

if(a1>a2)

{sq=Math.pow(a2,2);

cb=Math.pow(a1,3);

System.out.println("When"+a1+"is greater, square="+sq+" and cube="+cb);}

if else(a1<a2)

{sq=Math.pow(a1,2);

cb=Math.pow(a2,3);

System.out.println("When"+a2+"is greater, square="+sq+" and cube="+cb);

}

else

System.out.println("both numbers are equal");

}}

Variable description:

a1= 1st number

a2= 2nd number

sq=square

cb=cube

#all int data type

pls Mark as brainliest

and follow me.

Answered by Anonymous
1

Answer:

mark the above as the brainliest.

Similar questions