Ex 8: (1 gram = 0.035274) Use any loop to display a table of conversion from grams to ounces. Let the grams vary from 1 to 5 incrementing by 0.1.
static void Main(string[] args)
{
double gram = 1;
double ounce;
do
{
ounce = gram * 0.035274;
Console.WriteLine("Gram {0:n1}\tOunces {1:n3}", gram, ounce);
gram += 0.1;
} while (gram <= 5);
Console.ReadKey();
}
No comments:
Post a Comment