C++ или Pascal или C# Разработать программу, которая рассчитывает урожайность зерновых в ц/га, если известны валовой сбор, выраженный в тоннах, и площадь
Function prime(x:integer):boolean; var t:boolean; d:integer; begin t := true; d := 2; while t and (d*d <= x) do begin if x mod d = 0 then t := false; d := d + 1 end; prime := t end;
function order(x:integer):boolean; var t:boolean; d:integer; begin d := -1; repeat t := x mod 10 > d; d := x mod 10; x := x div 10 until not t or (x = 0); order := t end;
var t:boolean; i,k,n:integer; begin t := false; read(k,n); for i := k to n do if prime(i) then if order(i) then begin write(i,' '); t := true end; if not t then write(0) end.
Const n=5; var a:array[1..n,1..n] of integer; i,j,s1,s2:integer; b:boolean; begin for i:=1 to n do for j:=1 to n do read(a[i,j]);b:=true; s1:=0; for j:=1 to n do s1:=s1+a[1,j]; for i:=1 to n do begin s2:=0; for j:=1 to n do s2:=s2+a[i,j]; if s1<>s2 then b:=false; s2:=0; for j:=1 to n do s2:=s2+a[j,i]; if s1<>s2 then b:=false; end; if b then writeln('Матрица - магический квадрат') else writeln('Матрица не является магическим квадратом'); end.
using System;
namespace Nomer5
{
class Program
{
static void Main(string[] args)
{
int a, b, c;
Console.WriteLine("Введите валовой сбор");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Введите площадь");
b = Convert.ToInt32(Console.ReadLine());
c = a / b;
Console.WriteLine("Урожайность равна " + c);
Console.ReadKey();
}
}
}