write a program in java to find out the potential energy by the formula (PE=m*g*h) where the values of m,g and h are entered by the user
Answers
Answered by
1
Answer:
If you are using intellij you can run this code:-
import java.util.Scanner;
public class HelloWorld{
public static void main(String []args){
Scanner a = new Scanner(System.in);
double m = a.nextDouble();
double g = a.nextDouble();
double h = a.nextDouble();
double pe = m*g*h;
System.out.println(pe);
}
}
&
if you are using bluej you can run this code
public class HelloWorld{
public void main(double m,double g,double h){
double pe = m*g*h;
System.out.println(pe);
}
}
Explanation:
Similar questions