Programming Course in C# ¡Free!

Several mutiplication tables, do-while

 Friday, April 05, 2013 published by Exercises C#
Proposed exercise

Display the multiplication tables from 2 to 6, using nested "do...while" statements.

Output



Solution


using System;
public class SeveralTimesTable
{
public static void Main()
{
int num, multiplier;

num = 2;

do
{

multiplier = 1;
do
{
Console.WriteLine("{0} x {1} = {2}", 
num, multiplier, num*multiplier);
multiplier++;
}
while (multiplier <= 10);

Console.WriteLine();
num++;

} while (num <= 6);
}   
}