Wednesday, August 7, 2013

Program for Newton's Law of Gravitation

In this program user inputs the mass of two bodies and the distance between them and calculate and output the Force of attraction between two masses according to Newton's law of gravitation.

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float f,m1,m2,r;
cout<<"Enter the value of two masses in Kg : ";
cin>>m1>>m2;
cout<<"Enter the distance between two masses in meters : ";
cin>>r;
f=(6.67*pow(10.0,-11.0)*m1*m2)/(r*r);
cout<<"The force of attraction between two masses = "<<f<<" Newton ";
getch();
}

6 comments:

  1. f=(6.67*pow(10.0,-11.0)*m1*m2)/(r*r);

    I don't understand this part can u plz explain....??

    ReplyDelete
  2. f=(6.67*pow(10.0,-11.0)*m1*m2)/(r*r);
    I don't understand this part p/z explain??

    ReplyDelete
  3. "f=(6.67*pow(10.0,-11.0)*m1*m2)/(r*r)"
    can you explain this above step ??

    ReplyDelete
  4. Reading something so delightful has a recuperating power for the spirit.
    Citywide Law Group

    ReplyDelete
  5. Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks Tulsa Private Investigations

    ReplyDelete
  6. On this page, you'll see my profile, please read this information. https://www.paulmankin.com/

    ReplyDelete