Printing Table with do while
loop
//Table do while loop
string c;
do
{
Console.WriteLine("Enter a number to print table");
int a = int.Parse(Console.ReadLine());
Console.WriteLine("table of " + a + " is");
int i = a;
do
{
Console.WriteLine(i);
i = i + a;
}
while (i <= a * 10);
Console.WriteLine("Do You want to continue Y/N");
c = Console.ReadLine();
if(c!="Y" && c!="N")
{
Console.WriteLine("Enter the correct value Y/N only");
Console.WriteLine("Do You want to continue Y/N");
c = Console.ReadLine();
}
}
while (c == "Y");
No comments:
Post a Comment