Viết chương trình tính giá trị của biểu thức:
\(\dfrac{1}{1.3}+\dfrac{1}{2.4}+...+\dfrac{1}{n(n+2)}\)
Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
Thuật toán:
Bước 1: Nhập n
Bước 2: i←1; a←0;
Bước 3: a←a+1/(i*(i+2));
Bước 4: i←i+1;
Bước 5: Nếu i<=n thì quay lại bước 3
Bước 6: xuất a
Bước 7: Kết thúc
Viết chương trình:
uses crt;
var a:real;
i,n:longint;
begin
clrscr;
write('Nhap n='); readln(n);
a:=0;
for i:=1 to n do
a:=a+1/(i*(i+2));
writeln(a:4:2);
readln;
end.
\(A=\dfrac{1}{2}.\left(1+\dfrac{1}{1.3}\right)\left(1+\dfrac{1}{2.4}\right)\left(1+\dfrac{1}{3.5}\right)....\left(\dfrac{1}{2015.2017}\right)\)
\(=\dfrac{1}{2}\left(\dfrac{2}{1}.\dfrac{2}{3}\right).\left(\dfrac{3}{2}.\dfrac{3}{4}\right).\left(\dfrac{4}{3}.\dfrac{4}{5}\right)....\left(\dfrac{2016}{2015}.\dfrac{2016}{2017}\right)\)
\(=\dfrac{1}{2}.\left(\dfrac{2}{1}.\dfrac{2}{3}\right).\left(\dfrac{3}{2}.\dfrac{3}{4}\right).\left(\dfrac{4}{3}.\dfrac{4}{5}\right).....\left(\dfrac{2016}{2015}.\dfrac{2016}{2017}\right)\)
\(=\dfrac{2016}{2017}\)
\(A=\dfrac{1}{2}\left(\dfrac{2.2}{1.3}\right).\left(\dfrac{3.3}{2.4}\right)...\left(\dfrac{2020.2020}{2019.2021}\right)\)
\(=\dfrac{1.2.2.3.3...2020.2020}{1.2.2.3.3.4.4...2019.2021}\)
\(=\dfrac{1}{2021}\)
\(A=\dfrac{1}{2}\cdot\left(1+\dfrac{1}{1\cdot3}\right)\left(1+\dfrac{1}{2\cdot4}\right)\left(1+\dfrac{1}{3\cdot5}\right)...\left(1+\dfrac{1}{2019\cdot2021}\right)\)
\(A=\dfrac{1}{2}\left(1+\dfrac{1}{2^2-1}\right)\left(1+\dfrac{1}{3^2-1}\right)\left(1+\dfrac{1}{4^2-1}\right)...\left(1+\dfrac{1}{2020^2-1}\right)\)
\(A=\dfrac{1}{2}\cdot\dfrac{2^2}{\left(2-1\right)\left(2+1\right)}\cdot\dfrac{3^2}{\left(3-1\right)\cdot\left(3+1\right)}...\left(\dfrac{2020^2}{\left(2020-1\right)\cdot\left(2020+1\right)}\right)\)
\(A=\dfrac{1}{2}\cdot\dfrac{2}{1}\cdot\dfrac{2}{3}\cdot\dfrac{3}{2}\cdot\dfrac{3}{4}\cdot...\cdot\dfrac{2020}{2019}\cdot\dfrac{2020}{2021}\)
\(A=\dfrac{1}{2}\cdot\dfrac{2}{1}\cdot\dfrac{3}{2}\cdot...\cdot\dfrac{2020}{2019}\cdot\dfrac{2}{3}\cdot\dfrac{3}{4}\cdot...\cdot\dfrac{2020}{2021}\)
\(A=\dfrac{1}{2}\cdot2020\cdot\dfrac{2}{2021}=\dfrac{2020}{2021}\)
\(=\dfrac{1}{2}\cdot\dfrac{2^2-1+1}{\left(2-1\right)\left(2+1\right)}\cdot\dfrac{3^2-1+1}{\left(3-1\right)\left(3+1\right)}\cdot...\cdot\dfrac{2016^2-1+1}{\left(2016-1\right)\left(2016+1\right)}\)
\(=\dfrac{1}{2}\cdot\dfrac{2}{1}\cdot\dfrac{3}{2}\cdot...\cdot\dfrac{2016}{2015}\cdot\dfrac{2}{3}\cdot\dfrac{3}{4}\cdot...\cdot\dfrac{2016}{2017}\)
\(=\dfrac{1}{2}\cdot2016\cdot\dfrac{2}{2017}=\dfrac{2016}{2017}\)
P = (1 + \(\dfrac{1}{1.3}\)).(1 + \(\dfrac{1}{2.4}\)).(1 + \(\dfrac{1}{3.5}\))....(1 + \(\dfrac{1}{2020.2022}\))
P = \(\dfrac{1.3+1}{1.3}\). \(\dfrac{2.4+1}{2.4}\).\(\dfrac{3.5+1}{3.5}\)....\(\dfrac{2020.2022+1}{2020.2022}\)
P=\(\dfrac{\left(2-1\right)\left(2+1\right)+1}{1.3}\).\(\dfrac{\left(3-1\right)\left(3+1\right)+1}{2.4}\)...\(\dfrac{\left(2021+1\right).\left(2022-1\right)+1}{2020.2022}\)
P = \(\dfrac{2.2}{1.3}\).\(\dfrac{3.3}{2.4}\).\(\dfrac{4.4}{3.5}\)....\(\dfrac{2021.2021}{2020.2022}\)
P = \(\dfrac{2.2021}{2022}\)
P = \(\dfrac{2021}{1011}\)
P = (1+\(\dfrac{1}{1.3}\)).(1+\(\dfrac{1}{2.4}\)).(1 + \(\dfrac{1}{3.5}\))...(1+\(\dfrac{1}{2020.2022}\))
P =\(\dfrac{1.3+1}{1.3}\).\(\dfrac{2.4+1}{2.4}\).\(\dfrac{3.5+1}{3.5}\)...\(\dfrac{2020.2022+1}{2020.2022}\)
P = \(\dfrac{(2-1)(2+1)+1}{1.3}\).\(\dfrac{(3-1)(3+1)+1}{2.4}\)...\(\dfrac{(2021-1)(2021+1)}{2020.2022}\)
P = \(\dfrac{2.2}{1.3}\).\(\dfrac{3.3}{2.4}\).\(\dfrac{4.4}{3.5}\)...\(\dfrac{2021.2021}{2020.2022}\)
P = \(\dfrac{2021}{1011}\)
uses crt;
var b:array[1..100] of integer;
i,n,d:integer;
begin
clrscr;
repeat
writeln('nhap n=');readln(n);
until n>0;
for i:=1 to n do
begin writeln('b[',i,']','=');readln(b[i]);end;
writeln('so cac so le la');
for i:=1 to n do
if b[i] mod 2<>0 then d:=d+1;
writeln(d);readln;end.
uses crt;
var n,i:longint; s:real;
begin
clrscr;
s:=0;
writeln('nhap vao n=');readln(n);
writeln('tong cua A la');
for i:=1 to n do
s:=s + 1/(i*(i+2));
writeln(s:4:3);readln;end.
uses crt;
var n,i:integer;
s:real;
begin
clrscr;
write('n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+1/(i*(i+2));
writeln('Ket qua la: ',s:4:2);
readln;
end.