Plz what is the code gravitational force easy code in dev c++
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
const double G = 6.67/pow(10, 11.0);
double M1 = 0;
double M2 = 0;
double R = 0;
cout << "Enter first object mass(kg): ";
cin >> M1;
cout << "Enter second object mass(kg): ";
cin >> M2;
cout << "Enter distance beetwen objects (m): ";
cin >> R;
cout << endl;
double F = G*M1*M2/(R*R);
cout << "Gravitational force is: " << F << " N." << endl;
return 0;
}
Comments
Leave a comment