Những câu hỏi liên quan
Trường Nguyễn
Xem chi tiết
Minh Lệ
1 tháng 4 2022 lúc 11:26

Program HOC24;

var i,n: integer;

S: real;

begin

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

s:=0;

for i:=1 to N do s:=s+1/i;

write('S= ',s:5:2);

readln

end.

Bình luận (0)
Chuu
Xem chi tiết
Minh Lệ
6 tháng 3 2023 lúc 23:26

Program HOC24;

uses crt;

var i,n: integer;

s: real;

begin

clrscr;

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

s:=0;

for i:=1 to n do s:=s+1/(i*(i+1));

write('S= ',s:6:2);

readln

end.

Bình luận (1)
Minh Lệ
7 tháng 3 2023 lúc 22:52

Program HOC24;

var i,n: integer;

S: real;

begin

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

i:=1; s:=0;

while i<=n do

begin

s:=s+i*(i+1);

i:=i+1;

end;

write('S=',S:5:2);

readln

end.

Bình luận (0)
daukhacgiabao
Xem chi tiết
Thu Tuyền
Xem chi tiết
Phía sau một cô gái
8 tháng 3 2023 lúc 15:05

program tinhtong;

var n,i : integer;

S : real;

begin

write('Nhap n: ');

readln(n);

i:=1;

S:=0;

while i<=n do

begin

S:=S+1/i;

i:=i+1;

end;

writeln('Tong S= ',S);

readln;

end.

Bình luận (0)
Nguyễn Hoàng Duy
24 tháng 3 2023 lúc 10:29

program tinh_tong_S;

var
  n, i: integer;
  S: real;

begin
  write('Nhap n: ');
  readln(n);
  
  S := 0;
  i := 1;
  
  while i <= n do
  begin
    S := S + 1 / i;
    i := i + 1;
  end;
  
  writeln('Tong S la: ', S:0:2);
  
  readln;
end.

Bình luận (0)
Thanh huyền
Xem chi tiết
Minh Lệ
7 tháng 3 2023 lúc 13:34

*for..do

Program HOC24;

var i,n: integer;

s: real;

begin

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

s:=0;

for i:=1 to n do s:=s+1/sqr(i);

write('S= ',s:6:2);

readln

end.

Bình luận (0)
Minh Lệ
7 tháng 3 2023 lúc 21:30

*while..do

Program HOC24;

var i,n: integer;

s: real;

begin

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

i:=1;

while i<=n do

begin

s:=s+1/sqr(i);

i:=i+1;

end;

write('S= ',s:6:2);

readln

end.

Bình luận (0)
Thu Tuyền
Xem chi tiết
Minh Lệ
7 tháng 3 2023 lúc 21:23

Program HOC24;

var i,n: integer;

S: longint;

begin

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

i:=1; s:=0;

while i<=n do

begin

s:=s+i;

i:=i+2;

end;

write('S=',S);

readln

end.

Bình luận (0)
Nguyễn Hoàng Duy
24 tháng 3 2023 lúc 10:30

program tinh_tong_S;

var
  n, i, S: integer;

begin
  write('Nhap n: ');
  readln(n);
  
  S := 0;
  i := 1;
  
  while i <= n do
  begin
    S := S + i;
    i := i + 2;
  end;
  
  writeln('Tong S la: ', S);
  
  readln;
end.

Bình luận (0)
Linh Nhi
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 3 2022 lúc 9:22

a: uses crt;

var i,n:integer;

s:real;

begin

clrscr;

s:=0;

for i:=1 to 100 do s:=s+1/i;

writeln(s:4:2);

readln;

end.

b: 

uses crt;

var i,n:integer;

s:real;

begin

clrscr;

s:=0;

i:=0;

while i<=100 do 

begin

inc(i);

s:=s+1/i;

end;

writeln(s:4:2);

readln;

end.

Bình luận (0)
KhanhHuy
Xem chi tiết
nguyễn an phát
21 tháng 3 2021 lúc 19:06

lệnh for...to...do:

a)program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  for i:=1 to 9 do s:=s+i;

  write(s);

readln;

end.

b)

program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  for i:=1 to 14 do

begin

if i mod 2=0 then

s:=s+i;

end;

  write(s);

readln;

end.

c)

program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  for i:=1 to 15 do

begin

if i mod 2=1 then

s:=s+i;

end;

  write(s);

readln;

end.

lệnh while...do

a)program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  i:=1;

while i<=9 do

begin

  s:=s+i;

i:=i+1;

end;

  write(s);

readln;

end.

b)program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  i:=1;

while i<=14 do

begin

if i mod 2=0 then

  s:=s+i

else i:=i+1;

end;

  write(s);

readln;

end.

c)

program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  i:=1;

while i<=15 do

begin

if i mod 2=1 then

  s:=s+i

else i:=i+1;

end;

  write(s);

readln;

end.

Bình luận (0)
Dolce and garbana
Xem chi tiết
Bùi Anh Tuấn
17 tháng 3 2021 lúc 20:29

Bình luận (0)
Bùi Anh Tuấn
17 tháng 3 2021 lúc 20:31

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

uses crt;

var s:real;

n,i:integer;

begin

clrscr;

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

s:=1;

for i:=1 to n do 

  s:=s*(i/n);

writeln(s:4:2);

readln;

end.

Bình luận (0)