Những câu hỏi liên quan
Kỳ AnH
Xem chi tiết
Thiên Phúc
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 12 2020 lúc 12:22

uses crt;

var n,i:integer;

begin

clrscr;

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

for i:=1 to n do 

  if (i mod 2=0) and (i mod 5=0) then write(i:4);

readln;

end. 

Bình luận (0)
Bùi Anh Tuấn
20 tháng 12 2020 lúc 20:04

Bình luận (0)
Bùi Anh Tuấn
20 tháng 12 2020 lúc 20:06

cách này cũng đúng nhá

Bình luận (0)
crazy
Xem chi tiết
datcoder
20 tháng 1 lúc 19:52

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)
Duy Thanh Bùi
Xem chi tiết
Duy Thanh Bùi
Xem chi tiết
Duy Thanh Bùi
Xem chi tiết
Phía sau một cô gái
20 tháng 3 2023 lúc 19:57

program SoHoanHao;

uses crt;

var

     i, j, n, s: integer;

begin

     clrscr;

     write('Nhap n: ');

     readln(n);

     for i := 1 to n do

     begin

          s := 0;

          for j := 1 to i - 1 do

          begin

               if i mod j = 0 then

                    s := s + j;

               end;

               if s = i then

                    writeln(i);

     end;

     readln;

end.

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

uses crt;

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

i,n,t,kt,j:integer;

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

writeln('Cac so vua nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln('Tong cua day so la: ',t);

kt:=0;

for j:=2 to trunc(sqrt(t)) do 

  if t mod j=0 then 

    begin

kt:=1;

break;

end;

if kt=0 then writeln(t,' la so nguyen to')

else writeln(t,' khong la so nguyen to');

readln;

end.

Bình luận (1)
dinhnguyentuhuy
Xem chi tiết
Nguyễn Lê Phước Thịnh
13 tháng 12 2020 lúc 22:29

uses crt;

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

i,n,t,kt:integer;

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

writeln('Cac so ban vua nhap la: ');

for i:=1 to n do 

write(a[i]:4);

writeln;

t:=0;

for i:=1 to n do

t:=t+a[i];

writeln('Tong cac so vua nhap la: ',t);

if t>=2 then 

begin

kt:=0;

for i:=2 to trunc(sqrt(t)) do 

  if t mod i=0 then 

begin

kt:=1;

break;

end;

 if kt=0 then writeln(t,' la so nguyen to')

else writeln(t,' khong la so nguyen to');

end

else writeln(t,' khong la so nguyen to');

readln;

end.

Bình luận (0)
Thư Uyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 20:05

Bài 1: 

uses crt;

var n,i,s:integer;

begin

clrscr;

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

s:=0;

i:=1;

while i<=n do 

  begin

s:=s+i;

inc(i);

end;

writeln('Tong cac so trong khoang tu 1 den ',n,' la: ',s);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 20:07

Bài 2: 

uses crt;

var n,i,s:integer;

begin

clrscr;

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

s:=0;

i:=1;

while i<=n do 

  begin

s:=s+i;

i:=i+2;

end;

writeln('Tong cac so le trong khoang tu 1 den ',n,' la: ',s);

readln;

end.

Bình luận (0)
NgocTuan
3 tháng 1 2022 lúc 20:13

alo

Bình luận (0)