Home > DeveloperSection > Forums > for loop In c#
Ankit Singh

Total Post:341

Points:2389
Posted on    December-06-2015 9:32 PM

 C# C#  .NET  Loop 
Ratings:


 1 Reply(s)
 221  View(s)
Rate this:
 I want to use for loop in c# Please help me.


aditya kumar Patel

Total Post:250

Points:1782
Posted on    December-06-2015 9:36 PM

The for loop is a bit different. It's preferred when you know how many iterations you want, either because you know the exact amount of iterations, or because you have a variable containing the amount.

using System;

namespace ForLoop

{

class Program

{

static void Main(string[] args)

{

int number = 10;

for (int i = 0; i < number; i++)

Console.WriteLine(i);

Console.ReadLine();

}

}

}


Don't want to miss updates? Please click the below button!

Follow MindStick