Câu 4:
Var a:array[1..1000] of integer;
s:longint;
i,n:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i);readln(a[i]);
If a[i] > 0 then s:=s+a[i];
End;
Write('Tong la ',s);
Readln
End.
Câu 1
Var a:array[1..1000] of real;
s:real;
i,n:integer;
Begin
Write('n = ');readln(n);
s:=1;
For i:=1 to n do
Begin
Write('Nhap so thu ',i);readln(a[i]);
If a[i] > 0 then s:=s*a[i];
End;
Write('Tich la ',s:10:2);
Readln
End.
Câu 5:
Var a:array[1..1000] of integer;
min,i,n:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i);readln(a[i]);
End;
min:=a[1];
For i:=2 to n do
If min > a[i] then min:=a[i];
Write('So nho nhat la ',min);
Readln
End.