Computer Science, asked by kvalwaysonline, 11 months ago

The time period of a Simple Pendulum is given by the formula:
T = 2π√(l/g)
Write a program in java to calculate the time period of a Simple Pendulum by taking length and acceleration due to gravity (g) as inputs.

Answers

Answered by profxxx
67

Answer:

import java. util.*;

class calcu

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in)

System.out.println("Enter length and gravity ");

int l=sc.nextInt();

int g=sc.nextInt();

double t=2*(22.0/7.0)*(Math.sqrt(l/g);

System.out.println("time period="+t);

}

}

Answered by mdszuha
21

import java.util.Scanner;

class time period

{

public static void main (String args [])

{

Scanner sc=new Scanner (System.in);

double t,l,g;

System.out.println("Enter length and acceleration due to gravity");

l=sc.nextDouble();

g=sc.nextDouble();

t=2*(22/7)*Math.sqrt(l/g);

System.out.println("Time period="+t);

}

}

Mark me as a brainliest

Similar questions