B=1/1+1/2+1/3...+1/n D=1/2+1/4+1/6...+1/n(số chẵn) F=1+1/3+1/5+1/7....1/n(số lẻ)

2 câu trả lời

b/

Program BTH;
uses crt;
var i,n:longint;
s:real;
Begin
        clrscr;
        write('Nhap n: ');readln(n);
        For i:=1 to n do s:=s+1/i;
        writeln('Tong day so tren la: ',s:4:2);
        readln;
end.

d/

Program BTH;
uses crt;
var i,n:longint;
s:real;
Begin
        clrscr;
        write('Nhap n: ');readln(n);
        For i:=1 to n do
        Begin
                If i mod 2=0 then s:=s+1/i;
        end;
        writeln('Tong day so tren la: ',s:4:2);
        readln;
end.

f/

Program BTH;
uses crt;
var i,n:longint;
s:real;
Begin
        clrscr;
        write('Nhap n: ');readln(n);
        For i:=1 to n do
        Begin
                If i mod 2=1 then s:=s+1/i;
        end;
        writeln('Tong day so tren la: ',s:4:2);
        readln;
end.

program oken;

uses crt;

var i,n:integer;

      b:real;

begin

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

b:=1;

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

writeln('B=',b:0:3);

readln;

end.

câu 2:

program oken;

uses crt;

var i,n:integer;

      d:real;

begin

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

d:=1;

for i:=1 to n do if i mod 2 = 0 then d:=d+(1/i);

writeln('D=',d:0:3);

readln;

end.

câu 3:

Program oken;
uses crt;
var i,n:intger;

     f:real;
Begin
        clrscr;
        write('Nhap n: ');readln(n);
        For i:=1 to n do If i mod 2=1 then f:=f+(1/i);
        writeln('F=',f:0:3);
        readln;
end.

Câu hỏi trong lớp Xem thêm