Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std; //yeah you need to add this on Android compilers
- #define G pow(6.67408, 0.00000000001) //defining constants
- int main ()
- //int main()
- {
- float m, n, s, f, x; //declare variables
- // collect inputs
- cout << "Enter mass of first object " << m << endl;
- //cin >> m;
- cout << "Enter mass of second object " << n << endl;
- //cin >> n;
- cout << "Enter the distance between them " << s << endl;
- //cin >> s;
- //process
- x = pow (s, 2);
- f = G * (m*n/x);
- //show output
- cout << "So the gravitational force between the two is = " << f;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement