Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
34
15
var a:array[1..100] of longint;
t,d1,n,d,i:longint;
begin
readln(n);
for i:=1 to n do read(a[i]);readln;
d:=0;d1:=0;t:=0;
for i:=1 to n do
if a[i]>0 then begin t:=t+a[i]; inc(d);end;
for i:=1 to n do
if a[i] mod 3=0 then inc(d1);
writeln(d);
writeln(t);
writeln(d1);
readln
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
Program NN;
Uses crt;
Var A: array[1..100] of longint;
n,i,sd,s: longint;
Begin
Clrscr;
Write('Nhap n: '); Readln(n);
For i:=1 to n do
Begin
Read(A[i]);
If A[i] > 0 then sd:=sd+A[i];
If A[i] mod 3 = 0 then inc(s);
End;
Writeln('1. ',sd);
Write('2. ');
For i:=1 to n do
If A[i] > 0 then Write(A[i],' ');
Writeln;
Write('3. ',s);
Readln
End.
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin