Những câu hỏi liên quan
Kỳ AnH
Xem chi tiết
Nguyễn Thanh Anh
Xem chi tiết
khánh băng
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 2 2023 lúc 22:35

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.

Bình luận (0)
GamingDudex
Xem chi tiết
Minh Lệ
9 tháng 2 2022 lúc 16:02

Program HOC24;

var m,n,i: integer;

Begin

write('Nhap N: '); readln(n);

write('Nhap M: '); readln(m);

for i:=m to n do if sqr(trunc(sqrt(i)))=i then write(i,' ');

readln

end.

Bình luận (0)
thik
Xem chi tiết
Phía sau một cô gái
3 tháng 4 2023 lúc 22:02

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.

Bình luận (0)
Nguyễn Hoàng Duy
4 tháng 4 2023 lúc 0:06

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.

Bình luận (0)
Thiên Phúc
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 12 2020 lúc 20:00

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.

Bình luận (0)
Trần Nhật Phong
Xem chi tiết
Nguyễn Lê Phước Thịnh
22 tháng 1 2021 lúc 23:07

uses crt;

var a,b,c:array[1..100]of integer;

i,n,dem,dem1,kt,j:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

dem:=0;

for i:=1 to n do 

  if sqrt(a[i])=trunc(sqrt(a[i])) then 

begin

inc(dem);

b[dem]:=a[i];

end;

dem1:=0;

for i:=1 to n do

  if a[i]>1 then

begin

kt:=0;

for j:=2 to trunc(sqrt(a[i])) do 

  if a[i] mod j=0 then kt:=1;

if kt=0 then 

begin

inc(dem1);

c[dem1]:=a[i];

end;

end;

if dem=0 then writeln('Trong day khong co so chinh phuong')

else begin

writeln('Cac so chinh phuong trong day la: ');

for i:=1 to dem do 

  write(b[i]:4);

end;

if dem1=0 then writeln('Trong day khong co so nguyen to')

else begin

writeln('Cac so nguyen to trong day la: ');

for i:=1 to dem1 do 

  write(c[i]:4);

end;

readln;

end.

Bình luận (0)
Ngô Tiến Dũng
Xem chi tiết
Bùi Anh Tuấn
26 tháng 1 2021 lúc 20:20

Bình luận (0)
Olives
26 tháng 1 2021 lúc 20:13

pascal nha bạn:

Program so_nguyen_chan;

uses crt;

var n,i:integer;

begin

writeln('Nhap n=');readln(n);

For i:=1 to n do

If i mod 2 = 0 then writeln('Cac so chan nho hon n la: ',i);

readln

end.

Bình luận (1)
Bùi Anh Tuấn
26 tháng 1 2021 lúc 20:15

có in bao gồm cả số nữa lại nữa không hay chỉ nhỏ hơn n

Bình luận (0)
crazy
Xem chi tiết

Program HOC24;

var i,d,j,n integer;

begin

readln(n);

for i:=2 to n do

begin

d:=0;

for j:=1 to i do

if i mod j =0 then d=d+1;

if d=2 then write(i,' ');

end;

readln

end.

Bình luận (0)