Do double value calculation in CSharp
Description
The following code shows how to do double value calculation.
Example
using System; //from ww w . j a v a 2 s.co m
public class Mars {
public static void Main() {
double distance = 34000000; // 34,000,000 miles
double lightspeed = 186000; // 186,000 per second
double delay = distance / lightspeed;
Console.WriteLine("Time delay when talking to Mars: " +
delay + " seconds.");
double delay_in_min = delay / 60;
Console.WriteLine("This is " + delay_in_min +
" minutes.");
}
}
The code above generates the following result.