A calculator which converts the weight from earth gravity to moon.Code example in C#

In the follow lines it is presented an example of code which calculates and convert the moon weight with the acceptance that the weight on ¬†moon is 17% of earh ‘s weight.It is a proposal solution of an exercise in the book “The guide of C# 3.0 .(Herbert Schildt-Mc Graw Hill”).All you have to do is to is to run it as console application in Visual Studio.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
class Program
static void Main(string[] args)

int st = 17;
float earth_gravity, moon_gravity;
Console.WriteLine(“Give earth weight \t”);


moon_gravity= earth_gravity*st/100;

Console.WriteLine(“The weight in moon is ” + moon_gravity);