Var i,j:integer; mas:array [1..10] of integer; begin randomize; for i:= 1 to 10 do mas[i]:=random(101); for j:=1 to 10-1 do for i:=1 to 10-j do if mas[i] mod 10 > mas[i+1] mod 10 then swap(mas[i],mas[i+1]); for i:=1 to 10 do writeln(mas[i]); end. 2) var a:array[1..10] of Integer; i,j:Integer; begin randomize; for i:=1 to 10 do a[ i]:=random(101); for i:=1 to 4 do for j:=i+1 to 5 do if a[ i] > a[ j] then swap(a[i],a[j]); for i:=5 to 9 do for j:=i+1 to 10 do if a[ i] < a[ j] then swap(a[i],a[j]);; for i:=1 to 10 do write(a[ i],' '); end.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int N = 45;
for (int i = 0; i < N; i++)
{
Console.WriteLine("Я молодец!");
}
}
}
}
Объяснение:
Основной код вот:
int N = 45; // Кол-во раз
for (int i = 0; i < N; i++)
{
Console.WriteLine("Я молодец!");
}
mas:array [1..10] of integer;
begin
randomize;
for i:= 1 to 10 do
mas[i]:=random(101);
for j:=1 to 10-1 do
for i:=1 to 10-j do
if mas[i] mod 10 > mas[i+1] mod 10 then
swap(mas[i],mas[i+1]);
for i:=1 to 10 do
writeln(mas[i]);
end.
2)
var a:array[1..10] of Integer;
i,j:Integer;
begin
randomize;
for i:=1 to 10 do
a[ i]:=random(101);
for i:=1 to 4 do
for j:=i+1 to 5 do
if a[ i] > a[ j] then
swap(a[i],a[j]);
for i:=5 to 9 do
for j:=i+1 to 10 do
if a[ i] < a[ j] then
swap(a[i],a[j]);;
for i:=1 to 10 do
write(a[ i],' ');
end.