while (Boolean Expression) { // Code will execute, while Boolean Expression is TRUE }
using System;
namespace TEPProject
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter Table of : ");
int TableOf = int.Parse(Console.ReadLine());
int TotalLength = 1;
while (TotalLength <= 20)
{
int TableValue = TotalLength * TableOf;
Console.WriteLine("{0} x {1} = {2}", TableOf, TotalLength, TableValue);
if(TotalLength==10)
{
Console.WriteLine("\n");
}
TotalLength++;
}
Console.WriteLine("\n\n");
}
}
}
So, that was all about How to use while Loop in C#. In our coming tutorial, we will have a loop at How to use do While Loop in C#. Till then take care !!! :)
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w