using System;
namespace restless
{
class Program
static void TaskFor()
for (int i = 0; i < 5; i++)
for (int j = 10; j > -1; j--)
Console.Write($"{j} ");
}
Console.WriteLine(12);
static void TaskWhile()
int i = 0, j = 10;
while(i < 5)
while(j > -1)
j--;
i++;
j = 10;
static void Main(string[] args)
Console.WriteLine("Через цикл for: ");
TaskFor();
Console.WriteLine("\nЧерез цикл while:");
TaskWhile();
Console.ReadKey();
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
using System;
namespace restless
{
class Program
{
static void TaskFor()
{
for (int i = 0; i < 5; i++)
{
for (int j = 10; j > -1; j--)
{
Console.Write($"{j} ");
}
Console.WriteLine(12);
}
}
static void TaskWhile()
{
int i = 0, j = 10;
while(i < 5)
{
while(j > -1)
{
Console.Write($"{j} ");
j--;
}
Console.WriteLine(12);
i++;
j = 10;
}
}
static void Main(string[] args)
{
Console.WriteLine("Через цикл for: ");
TaskFor();
Console.WriteLine("\nЧерез цикл while:");
TaskWhile();
Console.ReadKey();
}
}
}