P011.c ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 12 Dec 2025
- License — MIT
Problem Statement ​
Problem Statement
The time period of a simple pendulam is given by the formula : t = 2 * pi * square_root(l / g) WAP to calculate T take length(L) and gravity as input
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
c
#include<stdio.h>
#include<math.h>
int main() {
double l, g, t;
printf("Enter the Length and Gravity measures : ");
scanf("%lf %lf", &l, &g);
t = 2 * M_PI * sqrt(l / g);
// using M_PI variable for PI value from math.h header file
printf("\nTime Period : %lf", t);
return 0;
}1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11