Write a program to compute the Time Period (T) of a Simple Pendulum as per the following formula: T = 2π√(L/g) Input the value of L (Length of Pendulum) and g (gravity) using the Scanner class.
PROGRAM :
import java.util.*;
class q2
{
public static void main(String args[ ])
{
Scanner sc=new Scanner(System.in);
System.out.println("ENTER LENGTH OF PENDULUM");
double l=sc.nextDouble();
System.out.println("ENTER THE GRAVITY");
double g=sc.nextDouble();
double t=2*3.14*Math.sqrt(l/g);
System.out.println("TIME OF PENDULUM:"+t);
}
}
OUTPUT :


Comments
Post a Comment