program rent; type arr = array of integer; var i, n, p, x, k1, k2, k3 : integer; a : arr; correct : boolean;
begin write('Введите количество предприятий: '); readln(n); if n>500 then n:=500; setLength(a, n); writeln('Введите доходность каждого предприятия'); for i:=0 to n-1 do begin correct := true; repeat readln(p); if abs(p)>10000 then begin writeln('Доход введён неправильно. Повторите ещё раз'); correct := false; end else correct := true; until correct; a[i] := p; end;
k1:=0; k2:=0; k3:=0; x:=0;
for i:=0 to n-1 do begin if a[i]>0 then k1 := k1+1; if a[i]<0 then k2 := k2+1; if a[i]=0 then k3 := k3+1; x := x+a[i]; end; writeln('Доходных: ', k1, ', убыточных: ', k2, ', с нулевым доходом: ', k3); writeln('Общий доход города: ', x); end.
{$mode objfpc}{$H+}
interface
uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, Spin, Math;
type
{ TForm1 }
TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; Edit2: TEdit; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; procedure Button1Click(Sender: TObject); private { private declarations } public { public declarations } end;
var Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);begin Form1.Label4.Caption:=FloatToStr(tan((StrToFloat(Form1.Edit1.text)*2)+StrToFloat(Form1.Edit2.text)));end;
end.