ICSE Class 10 Computer Applications
Question 10 of 14
Mathematical Library Methods — Question 10
Back to all questions 10
Question Question 10
Write a program to compute and display the value of expression:
where, the values of x, y and z are entered by the user.
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
