I use printf & scanf in the program below.
I enter a value and then the value is used in the formulas.
But all the program does is printing and although I can put some number... the program does nothing.
No error, no warning, nothing...
It just stops there.
So I think there's something wrong aobut the scanf...
Can someone help me?
Code:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define PI 3.14
#define g 9.807
int main(void)
{
double period, length;
printf("enter length : ");
scanf("%lf\n", &length);
period=2*PI*sqrt(length/g);
length=(period*period*g)/(4*PI*PI);
printf("period is %g\n", period);
printf("length is %g\n", length);
getch();
return 0;
}