settingsAccountsettings
By using our mini forum, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy
Menusettings

Q: Calculate the weight of a man on the Moon in C#

+3 votes

The gravitational field of the Moon is approximately 17% of that on the Earth.

Write a program that calculates the weight of a man on the Moon by a given weight on the Earth.

Examples:

 

weight:

weight on the Moon:

86

14.62

74.6

12.682

53.7

9.129

 

asked in C# category by user Jolie Ann
edited by user golearnweb

2 Answers

+2 votes
 
Best answer

My solution:

using System;

class GravitationOnTheMoon
{
    static void Main()
    {
        Console.WriteLine("Please enter your current weight: ");
        double weightEarth = double.Parse(Console.ReadLine());

        double weightMoon = weightEarth * 0.17;
        Console.WriteLine("Your weight {0} kg. on the Moon will be: {1} kg.", weightEarth,weightMoon);
    }
}

calculate the weight on the Moon in C Sharp
 

answered by user mitko
edited by user golearnweb
+2 votes
using System;

class GravitationOnTheMoon
    {
        static void Main()
        {
            Console.WriteLine("Please, eneter the weight of the person: ");
            double weight = double.Parse(Console.ReadLine());
            Console.WriteLine("The weight on the moon is: {0}", 17 * weight / 100);
        }
    }
answered by user richard8502
edited by user golearnweb
...