For loop in C#


//For Loop in C#

using System;
using System.Windows.Forms;//To use MessageBox.Show

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i <= 3; i++)
            {
                MessageBox.Show("Hi  "+i); //Displays the message in box. Works like Console.Write("Hi  "+i) (i.e. print command).
            }
        }
    }
}

No comments:

Post a Comment