سلام و درود استاد...وقتتون بخیر باشه
نمایش پلکانی اعداد با استفاده از حلقه for
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Please Enter Number : ");
string input = Console.ReadLine();
try
{
int num = Convert.ToInt32(input);
Console.ResetColor();
Console.ForegroundColor = ConsoleColor.Cyan;
for (int a = 1; a <= num;)
{
Console.WriteLine();
int b = 1;
for (b = 1; b <= a;)
{
Console.Write(b + " ");
b++;
}
a++;
}
Console.ResetColor() ;
}
catch
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Please Enter Just Number ! ");
Console.ResetColor();
}
بسیار عالی