var a: array[1..t] of integer; i, min, k, tmp, klv, z: integer; b: boolean;
begin
for i := 1 to t do a[i] := random(10) + 1; //Рандом чисел от 1 до 10
writeln('Массив:'); for i := 1 to t do write(' ', a[i]:2); writeln;
for i := 1 to t - 1 do for k := i + 1 to t do if a[i] > a[k] then begin tmp := a[k]; a[k] := a[i]; a[i] := tmp; end;
writeln('После сортировки:'); for i := 1 to t do write(' ', a[i]:2); writeln;
klv := 0; writeln('Введите число X:'); readln(z); for i := 1 to t do if a[i] = z then begin b := true; inc(klv); end; if b then begin writeln('Число ', z, ' встречается ', klv, ' раз(а).'); end;
if b = false then writeln('Число ', z, ' не встречается.'); end.
Объяснение:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace example
{
class Program
{
static void Main(string[] args)
{
int x, answer1, answer2;
Console.Write("Введите x : ");
x = int.Parse(Console.ReadLine());
answer1 = 2*x+3*Convert.ToInt32(Math.Pow(x,2))-4*Convert.ToInt32(Math.Pow(x,3));
answer2 = 1+2*x+3*Convert.ToInt32(Math.Pow(x,2))+4*Convert.ToInt32(Math.Pow(x,3));
Console.WriteLine("Значение первого выражения : " + answer1);
Console.WriteLine("Значение второго выражения : " + answer2);
Console.ReadLine();
}
}
}