Triangle cods with methods
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Training
{
class Program
{
static void Triangle(int count)
{
for (int i = 0; i < count; i++)
{
for (int j = 0; j < count - i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
}
static void Triangle1(int count)
{
for (int i = 0; i < count; i++)
{
for (int j = 0; j < i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
}
static void Triangle2(int count)
{
for (int i = 0; i < count; i++)
{
for (int j = 0; j < i; j++)
{
Console.Write(" ");
}
for (int j = 0; j < count - i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
}
static void Triangle3(int count)
{
for (int i = 0; i < count; i++)
{
for (int j = 0; j < i; j++)
{
Console.Write("*");
}
for (int j = 0; j < i; j++)
{
Console.Write(" ");
}
Console.WriteLine();
}
}
static void Main(string[] args)
{
int count = Convert.ToInt32(Console.ReadLine());
Triangle(count);
Triangle1(count);
Triangle2(count);
Triangle3(count);
}
}
}
Комментарии
Отправить комментарий