for loop In c#

 I want to use for loop in c# Please help me.
Last updated:12/6/2015 9:36:58 PM

1 Answers

Anonymous User
Anonymous User

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();

}

}

}

Answer