*
**
***
در این مثال می خواهیم با استفاده از سی # یک مثلث قایم الزاویه مانند شکل روبرو را رسم کنیم در این مثال با اجرای یک بار For اول میزان For دوم ابتدا یک بار و دفعه بعد 2 بار و دفعه بعدی سه بار اجرا می شود
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Adslfa
{
internal class Program
{
static void Main(string[] args)
{
for (int i = 0; i <= 7; i++)
{
for (int j = 5; j <= i; j++)
Console.Write("*");
Console.Write("\n");
}
}
}
}
- ۰۱/۰۱/۱۷