Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  10
Language: PASCAL
Code:
Program z1;
var a:array[1..n] of integer;
    i,k,k1,s,s1,n: integer;
    sr,sr1: real;
begin
readln(n);
for i:=1 to n do
begin a[i]:=random(100-0+1)+0;
write(a[i],' ');
end;
s:=0; s1:=0; k:=0; k1:=0;
for i:=1 to n do
begin
if a[i]>=0 then
begin
s1:=s1+a[i];
k1:=k1+1;
end
else 
s:=s+a[i];
k:=k+1;
end;
sr:=s/k;
sr1:=s1/k1;
writeln('sr=',sr);
writeln('sr1',sr1);
end.
          
          
Comments: