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
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.

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.

nguyễn thị kim ngân
Xem chi tiết
Minh Lệ
16 tháng 4 2023 lúc 22:25

Program HOC24;

var p: longint;

i,x: integer;

Begin

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

p:=1;

for i:=3 to x do if i mod 2=1 then p:=p*i;

write('P = ',p);

readln

end.

8G_4 Nguyễn Thu Hiền
Xem chi tiết
8G_4 Nguyễn Thu Hiền
15 tháng 5 2022 lúc 14:24

Mọi người ơi, giải giúp mình bài này với ạkhocroi

duc nguyen
Xem chi tiết
nguyễn thị mai hương
Xem chi tiết
Nguyễn Lê Yến Nhi
5 tháng 5 2019 lúc 14:43

chịu nạ

Lê Thiên Hương
11 tháng 2 2021 lúc 15:52

program chia;

uses crt;

var n,i:integer;

s:real;

begin 

clrscr;

s:=0;

for i:=2 to 50 do s:=s+1/i;

writeln('Tong la ',s:1:2);

readln;

end.

 

 

huy =)
Xem chi tiết
Phía sau một cô gái
3 tháng 4 2023 lúc 22:07

Câu lệnh for ... do 

program Tinh_Tich;

var

     n, i: integer;

     S: double;

begin

     write('Nhap vao so nguyen N: ');

     readln(n);

     S := 1;

     for i := 7 to n do

     begin

          S := S * i * i * i;

     end;

     writeln('Tich cac so 7^3*8^3*9^3*...*N^3 la: ', S);

     readln;

end.

Câu lệnh while .... do

program Tinh_Tich;

var

     n, i: integer;

     S: double;

begin

     write('Nhap vao so nguyen N: ');

     readln(n);

     S := 1;

     i := 7;

     while (i <= n) do

     begin

          S := S * i * i * i;

          i := i + 1;

     end;

     writeln('Tich cac so 7^3*8^3*9^3*...*N^3 la: ', S);

     readln;

end.

Vương Khánh ngọc
Xem chi tiết
Minh Lệ
29 tháng 4 2021 lúc 14:38

Program HOC24;

var i,n: integer;

s: real;

begin

n:=3; s:=0;

while n<=36 do

begin

s:=s+2/n;

n:=n+3;

end;

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

readln

end.

phúc võ
Xem chi tiết
Đặng Phương Linh
23 tháng 3 2023 lúc 11:05

program Tinh_S;

var i,n:integer;

     S:real;

begin

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

    i:=1 ; S:=0;

    while i<=n do

       begin

          S:=S+1/n*(n+1); i:=i+1;

       end;

   writeln('Tong S=',S);

  readln

end.

 

 

 

      

Mun UwU
23 tháng 3 2023 lúc 11:37

program Tinh_S;

var i,n:integer;

     S:real;

begin

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

    i:=1 ; S:=0;

    while i<=n do

       begin

          S:=S+1/n*(n+1); i:=i+1;

       end;

   writeln('Tong S=',S);

  readln

end.

Nguyễn Hoàng Duy
24 tháng 3 2023 lúc 10:27

program tinh_tong_S;

var
  n: integer;
  i: integer;
  S: real;

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