Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program lab1v8n2;
- var
- A:array[1..1000]of Integer;
- D:array of Real;
- N:Integer;
- procedure ProcessData;
- var i,num,a_p,a_n:Word;
- med:Real;
- begin
- med:=0;
- a_p:=0;
- a_n:=0;
- for i:=1 to N do
- if a[i]>0
- then begin
- med:=med+a[i];
- Inc(a_p);
- end
- else Inc(a_n);
- if a_p>0 then med:=med/a_p;
- SetLength(D,N+1);
- for i:=1 to N do
- if i mod 2=0
- then D[i]:=a_n
- else D[i]:=med;
- end;
- procedure ImportData;
- var j:Integer;
- begin
- WriteLn('Input the length, then the elements of an array');
- ReadLn(N);
- for j:=1 to N do Read(a[j]);
- end;
- procedure ExportData;
- var j:Integer;
- begin
- WriteLn;
- for j:=1 to N do
- if j mod 2=0
- then Write(d[j]:0:0,' ')
- else Write(d[j]:0:4,' ')
- end;
- //main
- begin
- ImportData;
- ProcessData;
- ExportData;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement