write a Java program to calculate the value of given expression: 1/a^2+2/b^2+3/c^2
Answers
Answered by
2
import java.util.*;
public class expression
{
public static void main(String[]args)
{
Scanner scan = new Scanner(System.in);
double a,b,c;
double value;
System.out.print("Enter the value of a :");
a=scan.nextDouble();
System.out.print("Enter the value of b :");
b=scan.nextDouble();
System.out.print("Enter the value of c :");
c=scan.nextDouble();
value=1.0/(a*a)+2.0/(b*b)+3.0/(c*c);
System.out.println("The value of the expression :"+value);
scan.close();
}
}
This is you program.
Similar questions