Answer to Question #173250 in C++ for Abdul wahab

Question #173250

Plz what is the code gravitational force easy code in dev c++


1
Expert's answer
2021-03-19T06:34:31-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS