Mega Code Archive

 
Categories / C# / Data Types
 

Displays a conversion table of Fahrenheit to Celsius

/*      This program displays a conversion      table of Fahrenheit to Celsius.       Call this program FtoCTable.cs.  */     using System;    public class FtoCTable {     public static void Main() {       double f, c;      int counter;        counter = 0;      for(f = 0.0; f < 100.0; f++) {        c = 5.0 / 9.0 * (f - 32.0); // convert to Celsius        Console.WriteLine(f + " degrees Fahrenheit is " +                          c + " degrees Celsius.");          counter++;          // every 10th line, print a blank line               if(counter == 10) {          Console.WriteLine();          counter = 0; // reset the line counter        }      }    }   }