HOC24
Lớp học
Môn học
Chủ đề / Chương
Bài học
uses crt;
var i,n,n,d: integer;
t: real;
A: array[1..32000] of integer;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(a[i]);
if a[i] <0 then
d:=d+1;
t:=t+a[i];
end;
writeln('Tong la:',t/n:2:4);
write('Co tat ca so so am la:',d);
readln;
end.
t: longint;
if a[i] >0 then
writeln('Tong la:',t);
write('Co tat ca so so duong la:',d);
var i,n,n,d; integer;
readln(m);
if a[i] = m then d:=d+1;
write(d);
1d
2a
3b
4d
5b
câu 2
const so: set of char=['0','1','2','3','4','5','6','7','8','9'];
var a:array[1..100] of integer;
st,b:string;
c,l,i,n,j:integer;
s, Max: integer;
begin clrscr;
write('Nhap xau:');
readln(st);
l:=length(st);
i:=1;
n:=0;
repeat if (st[i] in so) then begin b:='';
repeat b:=b+st[i];
inc(i);
until (not(st[i] in so)) or (i>l);
inc(n);
val(b,a[n],c);
until i>l;
Max:=a[1];
for i:=2 to n do If Max<A[i] Then Max:=A[i];
Writeln('Phan tu lon nhat cua mang:', Max);
câu 1
Program Nguyen_to;
Var n,i:integer;
Function NT(n:integer):Boolean;
Var ok: Boolean;
i: integer;
Begin ok:=true;
for i:=2 to n-1 do if (n mod i)= 0 then ok:=ok and false;
if n < 2 then NT:=false else NT:=ok;
End;
Begin Write('Nhap n: ');
Readln(n); i:=n;
Repeat i:=i+1;
Until NT(i);
Write('So nguyen to nho nhat lon hon ',n, 'la: ',i);
Readln End.