The force of gravity between two objects is
Force = G M₁ M₂ / D²
G = the SI gravitational constant= 6.67 x 10⁻¹¹ newton-meter² / kilogram²
M₁ and M₂ = the masses of the objects
D = the distance between their centers
In order for this simple formula to work, the masses need to be in kilograms,
and the distance needs to be in meters.
M₁ = 5g = 0.005 kilogram
M₂ = 10g = 0.01 kilogram
D = 0.5 meter . . . . . D² = 0.25 m²
Force = (6.67 x 10⁻¹¹) (0.005) (0.01) / (0.25) = 1.334 x 10⁻¹⁴ newton
In standard form, that's 0.00000000000001334 newton .
That force feels like about 0.000000000000048 ounce .