C# - How To Create A Equilateral Triangle Star Program In C#

C# - How To Create A Program To Print Equilateral Triangle Star Program In C#

                                                                                                                                         

In This C# Tutorial We Will See How To Make A Program To Print A Equilateral Triangle Using For Loop In C# Programming Language.

Source Code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
              //20 = how much lines
       for(int i = 1; i <= 20; i++)
        {
            //loop to print stars

                for(int t = 1; t <= i; t++)
                {
                  Console.Write("*");  
                }
            //create a new Line
            Console.WriteLine();
        }
        
            Console.ReadLine();
        }
    }
}
//////////OUTPUT:
Equilateral Triangle Star In C#
Triangle In C#




Share this

Related Posts

Previous
Next Post »