Tuesday, December 13, 2011

Program to display conversion table of inches to meters in C-Sharp


//This program displays a conversion table of inches to meters and prints a blank line after each 12 count.
using System;
class InchtoMeterTable
{
    static void Main()
    {
        double inches, meters;
        int counter;

        counter = 0;
        for (inches = 1.0; inches <= 144.0; inches++)
        {
            //convert to meters
            meters = inches / 39.37;
            Console.WriteLine(inches + " inches is " + meters + " meters.");
            counter++;

            //Every 12th line, print a blank line.
            if (counter == 12)
            {
                Console.WriteLine();
                counter = 0; //reset the line counter
            }

        }
    }
}

No comments:

Google : The top most search engine

Google : MAGIC BOX

nRelate - Posts and Homepage

LinkWithin

Related Posts Plugin for WordPress, Blogger...

Which is the toughest subject ?