Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
program trungbinhcong;
uses crt;
var a: array[1..80]of integer; tb: real; tong: integer; i,n,sl: byte; begin clrscr; writeln('nhap n: '); readln(n); for i:= 1 to n do begin writeln('nhap a[',i,']: '); readln(a[i]); end; tong:=0; sl:=0; for i:= 1 to n do if (a[i] mod 2 <> 0) then begin sl:=sl+1; tong:=tong+a[i]; end; tb:=tong/sl; writeln('trung binh cong cua cac phan tu le trong mang la: ', tb:4:3); readlnend.
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Chi so cua so hang cuoi cung la: ',n);
readln;
end.
uses crt;
var a:array[1..250]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
writeln(t);
readln;
end.
uses crt;
var a:array[1..250]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then t:=t+a[i];
writeln(t);
readln;
end.
Program FNG;
Uses crt;Var A: array[1..1000] of longint; n,i,s,da,sa: longint;Begin Clrscr; Write('Nhap n: '); Readln(n); s:=0; da:=0; sa:=0; For i:=1 to n do Begin Write('A[',i,'] = '); Readln(A[i]); s:=s+A[i]; If A[i]<0 then Begin inc(da); sa:=sa+A[i]; End; End; Writeln('S = ',s); Writeln('Dem am = ',da) Write('Tong am = ',sa); ReadlnEnd.
const fi='inp.inp';
fo='out.inp';
var f1,f2:text;
st:array[1..100]of string;
i,n:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(f1,st[n]);
end;
for i:=1 to n do
writeln(f2,length(st[i]));
close(f1);
close(f2);
end.