Do this while i is less that or equal to 30. Count the number of times the loop is executed and store that value in the count variable.
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
int i = 1; int count = 0;
do
{
count++;
i = i;
i++;
} while (i<=30);
Console.WriteLine("The loop repeated " + count + " times and now i is " + i);
}
}
}
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
int i = 1; int count = 0;
do
{
count++;
i = i;
i++;
} while (i<=30);
Console.WriteLine("The loop repeated " + count + " times and now i is " + i);
}
}
}
John IwaszPosted Dec 17, 2018, 4:07 PM