Computer Applications
Write a program to compute and display the value of expression:
where, the values of x, y and z are entered by the user.
Java
Java Math Lib Methods
9 Likes
Answer
import java.util.Scanner;
public class KboatExpression
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter x: ");
int x = in.nextInt();
System.out.print("Enter y: ");
int y = in.nextInt();
System.out.print("Enter z: ");
int z = in.nextInt();
double result = 1 / Math.pow(x, 2) + 1 / Math.pow(y, 3) + 1 / Math.pow(z, 4);
System.out.println("Result = " + result);
}
}
Output
Answered By
2 Likes
Related Questions
Write a program to generate random integers in the following ranges:
i. 10 to 20 (both inclusive)
ii. 25 to 50 (both inclusive)Write a program that accepts a number x and then prints:
x0, x1, x2, x3, x4, x5
Write a program in Java to find the maximum of three numbers using Math.max() method.
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.