program Project2; {$APPTYPE CONSOLE} uses SysUtils; var i,x,y,z, dwa,tri,shetire,pati:Integer; begin Writeln('student Fediya='); Readln(i); Writeln('student Sungat='); readln(x); Writeln('student Alex='); readln(y); Writeln('student Halif='); Readln(z); case i of 2: Inc(dwa); 3: Inc(tri); 4: Inc(shetire); 5: Inc(pati); end; begin case x of 2: Inc(dwa); 3: Inc(tri); 4: Inc(shetire); 5: Inc(pati); end; end; begin case y of 2: Inc(dwa); 3: Inc(tri); 4: Inc(shetire); 5: Inc(pati); end; end; begin case z of 2: Inc(dwa); 3: Inc(tri); 4: Inc(shetire); 5: Inc(pati); end; end; WriteLn(#13#10'dwa: ', dwa, #13#10'tri: ', tri, #13#10'shetire: ', shetire, #13#10'pati: ', pati); ReadLn; { TODO -oUser -cConsole Main : Insert code here }end.
// Массив из "a" заполнил псевдорандомными числами от 0 до 3 для наглядности
using System;
namespace ConsoleApp1
{
internal class Program
{
private static void Main()
{
const int numsCount = 24;
const int resCount = 10;
double[] nums = new double[numsCount];
double[] res = new double[resCount];
var rand = new Random();
for (int i = 0; i < numsCount; i++)
{
nums[i] = rand.Next(0, 4);
Console.WriteLine($"a[{i}] = {nums[i]}");
}
Console.WriteLine();
for (int i = 1; i <= resCount; i++)
{
double sum = 0;
for (int j = 0; j < numsCount; j++)
sum += Math.Pow(nums[j], i);
res[i - 1] = sum;
Console.WriteLine($"b[{i - 1}] = {sum}");
}
Console.ReadLine();
}
}
}