I am new to stackoverflow so sorry for my inappropriately long question or format of question.
I tried this program to calculate gravitational force.so far i have tried these things and they don't seem to work.
#include <stdio.h>
#include <conio.h>
#include <math.h>
#define G 6.67e-11
main()
{
long double r;
long double m1,m2,F;
printf("Enter m1:-");
scanf("%Lf",&m1);
printf("Enter m2:-");
scanf("%Lf",&m2);
printf("Enter distance between m1 and m2:-");
scanf("%Lf",&r);
F=(G*m1*m2)/(r*r);
printf("The force is:-%Le",F);
return;
}
Now i have tried many variations in the last line of code.
printf("The force is:-%e",F);
like instead of %e i have tried %Lf as i have defined F as long double. also when i run the code as is above and enter the following inputs
ie.
Enter m1:10
Enter m2:2
Enter m3:10
answer as
force is:1.327e-317
instead of 1.334e-11.
which i calculated in calculator.
and if there is a problem with #define please elaborate about how i can define constants in exponential form and use them for similar calculations.
please help.