var
a:array[1..12] of integer;
i:integer;
begin
randomize;
writeln('Сгенерированный массив:');
for i := 1 to 12 do
a[i] := random(36) - 15;
write(a[i], ' ');
end;
writeln;
end.
//вторая программа
const
n = 8;
a:array[1..n] of integer;
i, count3, count4, count5:integer;
writeln('Оценки учеников:');
for i := 1 to n do
a[i] := random(3) + 3;
if a[i] = 5 then
inc(count5);
if a[i] = 4 then
inc(count4);
if a[i] = 3 then
inc(count3);
writeln('Троек - ', count3);
writeln('Четверок - ', count4);
writeln('Пятерок - ', count5);
//третья программа
k:array[1..12] of integer;
k[i] := random(36) - 15;
write(k[i], ' ');
writeln('Преобразованный массив:');
k[i] := k[i] * (-1);
using System;
class Program
{
static void Main()
{
int x1 = 2, y1 = 1;
int x2 = 6, y2 = 5;
int x3 = 10, y3 = 1;
var a = Distance(x2, y2, x3, y3);
var b = Distance(x1, y1, x3, y3);
var c = Distance(x2, y2, x1, y1);
Console.WriteLine("S = {0}", Square(a, b, c));
Console.ReadKey();
}
//растояние между точками
static double Distance(int x1, int y1, int x2, int y2)
{
return Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
//формула герона
static double Square(double a, double b, double c)
{
var p = (a + b + c) / 2;
return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
}
// теорема косинусов
static double Angle(double a, double b, double c)
{
return Math.Acos((b * b + c * c - a * a) / (2 * b * c));
}
static bool IsAcuteAngel(double alpha)
{
return alpha < Math.PI / 2;
}
}
var
a:array[1..12] of integer;
i:integer;
begin
randomize;
writeln('Сгенерированный массив:');
for i := 1 to 12 do
begin
a[i] := random(36) - 15;
write(a[i], ' ');
end;
writeln;
end.
//вторая программа
const
n = 8;
var
a:array[1..n] of integer;
i, count3, count4, count5:integer;
begin
randomize;
writeln('Оценки учеников:');
for i := 1 to n do
begin
a[i] := random(3) + 3;
write(a[i], ' ');
if a[i] = 5 then
inc(count5);
if a[i] = 4 then
inc(count4);
if a[i] = 3 then
inc(count3);
end;
writeln;
writeln('Троек - ', count3);
writeln('Четверок - ', count4);
writeln('Пятерок - ', count5);
end.
//третья программа
var
k:array[1..12] of integer;
i:integer;
begin
randomize;
writeln('Сгенерированный массив:');
for i := 1 to 12 do
begin
k[i] := random(36) - 15;
write(k[i], ' ');
end;
writeln;
writeln('Преобразованный массив:');
for i := 1 to 12 do
begin
k[i] := k[i] * (-1);
write(k[i], ' ');
end;
end.