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.
uses crt;
var a:array[1..100]of integer;
i,n,dem,kt,j:integer;
begin
clrscr;
readln(n);
for i:=1 to n do write(i:4);
writeln;
for i:=2 to n do
begin
kt:=0;
for j:=2 to i-1 do
if i mod j=0 then kt:=1;
if kt=0 then write(i:4);
end;
readln;
end.
program Chan_Le;
var
n, i: integer;
begin
write('Nhap vao so nguyen N: ');
readln(n);
writeln('Cac so chan tu 1 den ', n, ' la:');
for i := 2 to n do
begin
if i mod 2 = 0 then
begin
write(i, ' ');
end;
end;
writeln;
writeln('Cac so le tu 1 den ', n, ' la:');
for i := 1 to n do
begin
if i mod 2 <> 0 then
begin
write(i, ' ');
end;
end;
readln;
end.
program Chan_Le;
var n, i: integer;
begin
write('Nhap vao so nguyen n: ');
readln(n);
writeln('Cac so chan tu 1 den ',n, ' la: ');
for i := 1 to n do
begin
if i mod 2 = 0 then
write(i, ' ');
end;
writeln;
writeln('Cac so le tu 1 den ', n, ' la: ');
for i := 1 to n do
begin
if i mod 2 <> 0 then
write(i, ' ');
end;
readln;
end.
uses crt;
var n,i,kt,j,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
writeln('Cac so nguyen to trong khoang tu 2 toi ',n,' la: ');
for i:=2 to n do
begin
kt:=0;
for j:=2 to i-1 do
if i mod j=0 then kt:=1;
if kt=0 then write(i:4);
end;
writeln;
writeln('Cac so chinh phuong trong khoang tu 0 toi ',n,' la: ');
for i:=0 to n do
if trunc(sqrt(i))=sqrt(i) then write(i:4);
writeln;
writeln('Cac so hoan hao trong khoang tu 1 toi ',n,' la: ');
for i:=1 to n do
begin
t:=0;
for j:=1 to i-1 do
if i mod j=0 then t:=t+j;
if t=i then write(i:4);
end;
readln;
end.
a)
uses crt;
var i,n:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n<100;
if n mod 2=0 then
begin
for i:=0 to n do
if i mod 2=0 then write(i:4);
end
else writeln(n,' khong la so chan');
readln;
end.
b)
uses crt;
var i,n:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n<100;
if n mod 2=1 then
begin
for i:=1 to n do
if i mod 2=1 then write(i:4);
end
else writeln(n,' khong la so le');
readln;
end.
uses crt;
var n,i,dem,dem1:integer;
begin
clrscr;
write('nhap n='); readln(n);
dem:=0;
dem1:=0;
for i:=1 to n do
begin
if i mod 2=0 then inc(dem);
if i mod 2=1 then inc(dem1);
end;
writeln('so luong so chan trong day so tu 1 toi ',n,' la: ',dem);
writeln('so luong so le trong day so tu 1 toi ',n,' la: ',dem1);
readln;
end.
var n,i:longint;
begin
readln(n);
if n mod 2=0 then write('chan: ',n div 2,' le: ',n div 2) else
write('chan: ',n div 2,' le: ',n div 2+1) ;
end.