PLEASE HELP ME :D

how will I do this one?
Problem statement: The gravitational attractive force between two bodies of mass m1, and m2 seperated by a distance d is given by F=G*m1*m2/d^2
where G is the universal gravitational constant:
G=6.673*10^8

Write a program that will read in the mass of two bodies and the distance between them, and then output the gravitational force between them. The output should be in dynes. One dyne equals a g-cm/sec^2. Use a constant declaration of G.

I'm just a begginer any help is much appriciated THANKS!
What do you have so far?
#include <iostream>
#include <cmath>
using namespace std;

int main()
{

const double G=.00000006673;
int m1, m2, d, F;

cout<<"Write the value of the first mass"<<endl;
cin>>m1;
cout<<"Write the value of the second mass"<<endl;
cin>>m2;
cout<<"Write the value of the distance"<<endl;
cin>>d;
cout<<"F="<<(G*m1*m2)/(d*d)<<endl;







return 0;
}

looks ok to me

however, if your units for distance is in m, and your F is cm, you will need to use a conversion factor
whatever the case, check your units to confirm that they make sense
My comment: The datatype of m1, m2, d, F should be "double" as well.
Topic archived. No new replies allowed.