Những câu hỏi liên quan
Nguyễn Thị Tươi
Xem chi tiết
Đỗ Trọng TÍn
Xem chi tiết
Kiều Vũ Linh
29 tháng 4 2023 lúc 7:52

Câu 3:

Var i,n:integer:

Begin

Write('n = ');readln(n);

Write('Cac uoc cua n la ');

For i:=1 to n do

If n mod i = 0 then write(i:8);

Readln

End.

Bình luận (0)
Kiều Vũ Linh
29 tháng 4 2023 lúc 7:56

Câu 4

Var i,n:integer:

Begin

Write('n = ');readln(n);

Write('Cac so le nho hon n la ');

For i:=1 to n - 1 do

If i mod 2 <> 0 then write(i:8);

Readln

End.

Bình luận (1)
ksie
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 1 2022 lúc 15:11

uses crt;

var n,i,dem,j,t:integer;

kt:boolean;

begin

clrscr;

readln(n);

t:=0;

for i:=2 to n do 

begin

kt:=true;

for j:=2 to i-1 do 

  if i mod j=0 then kt:=false;

if kt=true then 

begin

write(i:4);

t:=t+i;

end;

end;

writeln;

writeln(t);

readln;

end.

Bình luận (0)
Cao Ngọc Bảo Quyên
Xem chi tiết
Gà Công Nghệ
Xem chi tiết
Anh Phạm
28 tháng 8 2021 lúc 19:43

uses crt;

var n,i,o,d:integer;

function ktnt(n:integer): integer;

var i,d:integer;

begin

d:=0;

for i:=1 to sqrt(n) do

if (n mod i=0) then d:=d+1;

if d=2 then ktnt=0

else ktnt=1;

end;

begin

readln(n);

writeln(' so nguyen to be hon hoac bang n la'); {a}

for i:=1 to n do

if ktnt(i)=0 then writeln(i);

writeln('so nguyen to nho nhat khong be hon n');

o:=n;

while o>0 do

begin

if ktnt(o)=0 then

begin

write(o);

break;

end;

o:=o+1;

end;

writeln('cặp số nguyên tố là hai số nguyên lẻ liên tiếp nhỏ hơn hoặc bằng n');

o:=0;

o:=1;

d:=0;

for i:=o+2 to n do

begin

if ktnt(i)=0 then

begin

d:=d+1;

write(i,' ');

if d<2 then continue;

end;

d:=0;

writeln;

end;

readln;

end.

Bình luận (1)
Vy Đan Hà Thị
Xem chi tiết
Minh Lệ
8 tháng 5 2023 lúc 22:02

Program HOC24;

var i,n: integer;

t: longint;

a: array[1..1000] of integer;

begin

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

for i:=1 to n do

begin

write('Nhap so thu ',i,': '); readln(a[i]);

end;

t:=0;

for i:=1 to n do t:=t+a[i];

write('Tong la; ',t);

readln

end.

Bình luận (0)
NgocTuan
Xem chi tiết
Lê Chiêu Nguyên	Vũ
4 tháng 4 2023 lúc 10:11

program Min;
uses crt;
var i,n:integer;
begin
   clrscr;
   write('Nhap n: '); readln(n);
   write('Cac so le nho hon hoac bang ',n,'la :');
   for i:=1 to n do if i mod 2 = 1 then write(i:4);
   readln
end.

Bình luận (0)
Phan Thị Ka
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:40

Câu 1:

Program HOC24;

var i,p: integer;

t: longint;

begin

write('Nhap P: '); readln(p);

t:=0;

for i:=1 to p do if i mod 2<>0 then t:=t+i;

write('Tong cac so le la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:41

Câu 2:

Program HOC24;

var i,n: integer;

t: longint;

begin

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

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

write('Tong cac so chan la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:42

Câu 3:

Program HOC24;

var i,t,n: integer;

begin

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

t:=0;

for i:=1 to n do if n mod i=0 then t:=t+i;

write('Tong cac uoc cua ',n,' la: ',t);

readln

end.

Bình luận (0)
trần hoàng
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 4 2022 lúc 21:52

uses crt;

var i,n,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do 

  if sqrt(i)=trunc(sqrt(i)) then t:=t+i;

writeln(t);

readln;

end.

Bình luận (0)
nam bảo
Xem chi tiết
Nguyễn Lê Phước Thịnh
24 tháng 2 2022 lúc 13:44

uses crt;

var n,m,i,dem,t,t1,d1:integer;

//chuongtrinhcon

function ktnt(var n:integer):boolean;

var i:integer;

kt:boolean;

begin

kt:=true;

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

  if n mod i=0 then kt:=false;

if (kt=true) then ktnt:=true

else ktnt:=false;

end;

//chuongtrinhchinh

begin

clrscr;

readln(n,m);

if (ktnt(n)=true) then writeln(n,' la so nguyen to')

else writeln(n,' ko la so nguyen to');

dem:=0;

t:=0;

for i:=2 to n do 

  if (ktnt(i)=true) then

begin

write(i:4);

t:=t+i;

dem:=dem+1;

end;

writeln;

writeln(t,' ',dem);

t1:=0;

d1:=0;

for i:=n to m do 

  if ktnt(i)=true then

begin

write(i:4);

t1:=t1+i;

inc(d1);

end;

writeln;

writeln(t1,' ',d1);

readln;

end.

Bình luận (0)