Write a java program to calculate the time period of a Simple Pendulum by taking length and acceleration due to gravity as input
Attachments:
Answers
Answered by
89
import java.util.*;
class Simple
{
public static void main()
{
Scanner sc=new Scanner(System.in);
double Time,pie=22/7,length,g=9.8;
System.our.println("Enter the length of pendulum");
length=sc.nextDouble();
Time=2*pie*(Math.sqrt(length,2)/Math.sqrt(g,2));
System.out.println("Time taken by simple pendulum is "+Time);
}
}
Hope it will help@
For more java programming follow me@
DivyanshGaurav:
nice
Answered by
11
Answer: correct answer..
Explanation:
import java. util.*;
class Time
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter length and gravity ");
double l=sc.nextDouble();
int g=sc.nextDouble();
double t=2*(22.0/7.0)*(Math.sqrt(l/g));
System.out.println("time period="+t);
}
}
Similar questions