Computer Applications
Write a program to print:
i. x to the power y
ii. the square root of y
The values of x and y are 81 and 3, respectively.
Java
Java Math Lib Methods
16 Likes
Answer
public class KboatNumber
{
public static void main(String args[]) {
int x = 81;
int y = 3;
double r1 = Math.pow(x, y);
System.out.println("x to the power of y = " + r1);
double r2 = Math.sqrt(y);
System.out.println("Square root of y = " + r2);
}
}
Output
Answered By
9 Likes
Related Questions
Write valid statements for the following in Java:
i. Print the rounded off value of 14.49
ii. Print the absolute value of -0.09
iii. Print the largest of -67 and -50
iv. Print the smallest of -56 and -57.4
v. Print a random integer between 25 and 35
vi. Print 47.5 raised to the power 6.3
vii. Print minimum of -4, -7
Write a program in Java to find the maximum of three numbers using Math.max() method.
Write a program to compute and display the value of expression:
where, the values of x, y and z are entered by the user.
Write a program to generate random integers in the following ranges:
i. 10 to 20 (both inclusive)
ii. 25 to 50 (both inclusive)