uses crt;
var i,n,sd,sa,sc,sl:integer;
a:array[1..100]of integer;
begin
write('spt=');readln(n);
sc:=0;sl:=0;sd:=0; sa:=0;
for i:=1 to n do
write('a[',i,']=');readln(a[i]);
if a[i] mod 2 =0 then inc(sc) else inc(sl);
if a[i]>0 then inc(sd) ;
if a[i]<0 then inc(sa);
end;
writeln('Co ',sl,' so le');
writeln('Co ',sc,' so chan');
writeln('Co ',sa,' so am');
writeln('Co ',sd,' so duong');
readln;
end.
Program vd1;
Var
A:array[1..100] of integer;
i,n,demSC,demNT,j: integer;
NT:boolean;
BEGIN
clrscr;
repeat
Write(' Nhap vao so nguyen duong N <=100 : ');
readln(N);
Until (n>1) and (n<=100);
For i:=1 to n do
write('A[',i,'] = ');
readln(A);
until abs(A)<=1000;
demSC:=0;
IF (A mod 2 =0) then demSC:=demSC+1;
DemNT:=0;
Begin
NT:=True;
For j:=2 to a-1 do
IF (A mod j = 0) then NT:=false;
IF NT then demNT:=demNT+1;
End;
Writeln(' So luong so chan = ',DemSC);
Writeln(' So luong so le = ',n-DemSC);
Writeln(' So luong so NT = ',DemNT);
END.
Copyright © 2024 VQUIX.COM - All rights reserved.
Answers & Comments
Verified answer
uses crt;
var i,n,sd,sa,sc,sl:integer;
a:array[1..100]of integer;
begin
write('spt=');readln(n);
sc:=0;sl:=0;sd:=0; sa:=0;
for i:=1 to n do
begin
write('a[',i,']=');readln(a[i]);
if a[i] mod 2 =0 then inc(sc) else inc(sl);
if a[i]>0 then inc(sd) ;
if a[i]<0 then inc(sa);
end;
writeln('Co ',sl,' so le');
writeln('Co ',sc,' so chan');
writeln('Co ',sa,' so am');
writeln('Co ',sd,' so duong');
readln;
end.
Program vd1;
uses crt;
Var
A:array[1..100] of integer;
i,n,demSC,demNT,j: integer;
NT:boolean;
BEGIN
clrscr;
repeat
Write(' Nhap vao so nguyen duong N <=100 : ');
readln(N);
Until (n>1) and (n<=100);
For i:=1 to n do
begin
repeat
write('A[',i,'] = ');
readln(A);
until abs(A)<=1000;
end;
demSC:=0;
For i:=1 to n do
IF (A mod 2 =0) then demSC:=demSC+1;
DemNT:=0;
For i:=1 to n do
Begin
NT:=True;
For j:=2 to a-1 do
IF (A mod j = 0) then NT:=false;
IF NT then demNT:=demNT+1;
End;
Writeln(' So luong so chan = ',DemSC);
Writeln(' So luong so le = ',n-DemSC);
Writeln(' So luong so NT = ',DemNT);
readln;
END.