# We know that , weight = mass X gravity ;
Suppose your weight on earth is 80.55 Newton, So, your mass is = (80.55/9.8) = 8.22 kg ; Now if we multiply your mass with moon_gravity we will find your weight on moon (Simple enough) .
# Given that moon_gravity is 17% of the gravity of earth.
So, weight = mass X moon_gravity ;
So, weight = mass X moon_gravity ;
= mass X ( (9.8 X 17) / 100 ) ; // We use this formula in our code
= 8.22 X ( (9.8 X 17) / 100 ) ;
= 13.69 N ;
= 8.22 X ( (9.8 X 17) / 100 ) ;
= 13.69 N ;
Note : If you have any confusion about this formula follow #Intermediate Physics Book (Chapter Name - Gravity)
Solution ::
Here, I do this code in very details. A problem can be solved in many way. So, you can modify this code as your wish.
Solution ::
- #include <stdio.h>
- void wt_on_mn(float mass); //Declare Function, this function calculate the weight and print it so here have no return type;
- void main ()
- {
- float weight,mass;
- printf("Enter your weight on earth:\n");
- scanf("%f",&weight);
- mass = (weight/9.8) ;
- wt_on_mn(mass); //Function called
- }
- void wt_on_mn(float mass) //Function
- {
- float w_on_moon;
- w_on_moon = mass * ((9.8*17)/100);
- printf("\nYour weight on moon is : %.2f\n",w_on_moon);
- }
Here, I do this code in very details. A problem can be solved in many way. So, you can modify this code as your wish.
Happy Coding.
No comments:
Post a Comment