Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Anh Thư
Xem chi tiết
ᴠʟᴇʀ
28 tháng 3 2022 lúc 8:20

uses crt;

var i,n,t:integer;

begin

clrscr;

readln(n);

t:=0; i:=1; 

while (i<=n) do 

  begin

if n mod i=0 then t:=t+i;

i:=i+1;

end;

writeln(t);

readln;

end.

Lê Hồng Thái Dương
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 2 2022 lúc 21:47

uses crt;

var i,n,t:integer;

begin

clrscr;

readln(n);

t:=0; i:=1; 

while (i<=n) do 

  begin

if n mod i=0 then t:=t+i;

i:=i+1;

end;

writeln(t);

readln;

end.

Tham khảo:

Uses crt;

Var   S, i: integer;

Begin

        clrscr;

        S : = 0;

        i := 1;

        while i <= 10 do

        begin

                S := S + i;

                i := i + 1;

        end;

        writeln (S);

        readln;

end.

  
Ánh Dương
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 3 2021 lúc 20:22

Bài 1: 

uses crt;

var a:real;

i,n:integer;

begin

clrscr;

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

a:=0;

i:=1;

while i<=n do 

begin

a:=a+1/i;

i:=i+1;

end;

writeln(a:4:2);

readln;

end.

Trần Thị Mai Ngọc
Xem chi tiết
nguyễn an phát
18 tháng 4 2021 lúc 20:48

program tim_uoc;

uses crt;

var i,n,tong:integer;

begin

clrscr;

write('nhap so n:');readln(n);

i:=1;tong:=0;

writeln('cac uoc cua ',n,' la:');

while i<=n do

if n mod i=0 then

begin

write(i:3);

inc(i);

end;

writeln;

i:=1;writeln('cac uoc chan:');

while i<=n do

begin

if n mod i=0 then 

begin

if i mod 2=0 then write(i:3);

tong:=tong+i;

end;

end;

writeln;

write('tong cac uoc chan:',tong);

readln;

end.

Nguyễn Lê Phước Thịnh
19 tháng 4 2021 lúc 19:17

uses crt;

var n,i,t:integer;

begin

clrscr;

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

i:=1;

writeln('Cac uoc cua ',n,' la: ');

while i<=n do

  begin

if n mod i=0 then write(i:4):

i:=i+1;

end;

writeln;

writeln('Cac uoc chan cua ',n,' la: ');

t:=0;

i:=1;

while i<=n do 

  begin

if (n mod i=0) then

begin

t:=t+i;

write(i:4);

end;

inc(i);

end;

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

readln;

end.

mẫn cuti
Xem chi tiết
Hoangg Linhh
14 tháng 5 2023 lúc 12:32

var i,n,s:longint;

begin 

read(n); if n<2 then break;

for i:=3 to n do s:=s+i;

write(s);

end.

Kiều Vũ Linh
15 tháng 5 2023 lúc 7:51

Var i,n:integer;

t:longint;

Begin

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

i:=2;

While i<=n do

Begin

t:=t+i;

i:=i+1;

End;

Write('Tong la ',t);

Readln

End.

Ngân
Xem chi tiết
ILoveMath
3 tháng 3 2022 lúc 9:21

For...do:

var s,i: integer;

begin

readln(s,i);

s:=0;

For i:=3 to 99 do

If i mod 3 = 0 do s:=s+i;

write(s)

readln;

end.

while ... do:

Var i,S:integer;

Begin

Readln(i,s);

S:=0;

i:=3;

while i<=99 do

if i mod 3 = 0 then s:=s+i;

write(s);

Readln;

End.

ILoveMath đã xóa
ILoveMath
3 tháng 3 2022 lúc 10:29

For...do:

var s,i: integer;

begin

readln(s,i);

s:=0;

For i:=3 to 99 do

If i mod 3 = 0 do s:=s+i;

write(s);

readln;

end.

while ... do:

Var i,S:integer;

Begin

Readln(i,s);

S:=0;

i:=3;

while i<=99 do

if i mod 3 = 0 then s:=s+i;

write(s);

Readln;

End.

Huỳnh Hân
Xem chi tiết
Minh Lệ
14 tháng 3 2023 lúc 23:01

Program HOC24;

var i,n: integer;

t: longint;

begin

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

if n<=5 then write('So vua nhap chua lon hon 15') else

begin

t:=0; i:=10;

while i<=n do

begin

t:=t+i;

i:=i+1;

end;

end;

write('Tong la: ',t);

readln

end.

ngtraidat
Xem chi tiết
Minh Lệ
12 tháng 3 2023 lúc 22:03

Program HOC24;

var i,n,t: integer;

begin

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

i:=2; t:=0;

while i<=n do

begin

t:=t+i;

i:=i+2;

end;

write('Tong cac so chan tu 1 den ',n,' la: ',t);

readln

end.

huyokkkkk
Xem chi tiết