do-while loop statement in C#
For Example: Write a
program to demonstrate using do-while loop statement.
(Display the table
of any entered number)
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace ConsoleApplication4
{
Class Program
{
Static void Main(string[] args)
{
int i = 1;
int no = 1;
Console.WriteLine("Enter any number
to display the Table:");
no =
Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Table of {0}
is", no);
do
{
Console.WriteLine(" {0} ", no
* i);
i++;
}
while (i <= 10);
Console.ReadLine();
}
}
}
Output:
Comments
Post a Comment