Talking to Mars : double : Data Types C# Source Code


Custom Search

C# Source Code » Data Types » double »

 

Talking to Mars









    

/*
C# A Beginner's Guide
By Schildt

Publisher: Osborne McGraw-Hill
ISBN: 0072133295
*/
/* 
   Project 2-1 
 
   Talking to Mars 
 
   Call this file mars.cs 
*/ 
 
using System; 
 
public class Mars {    
  public static void Main() {    
    double distance; 
    double lightspeed; 
    double delay; 
    double delay_in_min; 
 
    distance = 34000000; // 34,000,000 miles 
    lightspeed = 186000; // 186,000 per second 
 
    delay = distance / lightspeed;     
 
    Console.WriteLine("Time delay when talking to Mars: " + 
                      delay + " seconds."); 
     
    delay_in_min = delay / 60; 
 
    Console.WriteLine("This is " + delay_in_min + 
                      " minutes."); 
  }    
} 




           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Data Types
» double