TT

Giúp mik câu 1 vs ạ

NH
3 tháng 5 2021 lúc 21:20

Uses crt;

Var i,n,k,tong:integer;

      tb:real;

      a:array[1..1000] of integer;

      f1,f2:text;

Begin

clrscr;

Assign(f1,'SONGUYEN.inp');

Assign(f2,'SONGUYEN.out');

Reset(f1);Readln(f1,n);

For i:= 1 to n do read(f1,a[i]);

close(f1);

k:=0;tong:=0;

For i:= 1 to n do If (a[i]<0) and (Abs(a[i]) mod 2 = 1) then

  Begin

  inc(k);

  tong:=tong+a[i];

  End;

tb:=tong/n;

Rewrite(f2);

writeln(f2,tb:0:2);

Writeln(f2,k);

close(f2);

readln;

End.

Bình luận (0)
NT
4 tháng 5 2021 lúc 13:24

Câu 2: 

const fi='xauhoa.inp'

fo='xauhoa.out'

var f1,f2:text;

st,s1:string;

d,i:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,st);

d:=length(st);

s1:=''

for i:=1 to d do 

  if st[i] in ['A'..'Z'] then s1:=s1+st[i];

writeln(f2,s1);

writeln(f2,length(s1));

close(f1);

close(f2);

end.

Bình luận (0)

Các câu hỏi tương tự
H24
Xem chi tiết
H24
Xem chi tiết
NP
Xem chi tiết
H24
Xem chi tiết
NL
Xem chi tiết
H24
Xem chi tiết
H24
Xem chi tiết
HP
Xem chi tiết
YH
Xem chi tiết