CSharp - Write program to Repeat the Same Text 10 times

Requirements

You will write a program that displays "hi" ten times in a row.

Hint

You need to use loop.

You use the for construction to indicate repetition. Its general syntax looks like this:

for (initializer; loopCondition; iterator) 
{ 
    statement; 
    statement; 
    statement; 
    ... 
} 
  • initializer is performed once before entering the loop.
  • loopCondition is being evaluated before every turn of the loop.
  • The iterator statement is executed after every turn of the loop is completed.

Demo

using System;
class Program//from  w  w w.j a  v  a2 s  .  c  o  m
{
    static void Main(string[] args)
    {
        // Output 
        for (int count = 0; count < 10; count++)
        {
            Console.WriteLine("hi");
        }

    }
}

Result