Friday, March 10, 2017

Loop (for loop)

// # If you know the number of iterations the loop should run beforehand, then we use for loop

// 1 to 100 series using for loop
using System;

namespace LoopTest
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i <= 100; i++)
            {
                Console.WriteLine("{0}\n", i);
            }
            Console.ReadKey();
        }
    }
}

No comments:

Post a Comment