Viết chương trình, sd lệnh While…do: $S=\dfrac{1}{2}+\dfrac{1}{2.2^2}+\dfrac{1}{2.3^2}+…+\dfrac{1}{2.n^2}$ 23/07/2021 Bởi Josephine Viết chương trình, sd lệnh While…do: $S=\dfrac{1}{2}+\dfrac{1}{2.2^2}+\dfrac{1}{2.3^2}+…+\dfrac{1}{2.n^2}$
program tinhtong; Uses crt; var S:real; n,i:inteegr; begin clrscr; write(‘Nhap n: ‘); readln(n); S:=0; i:=1; while i<=n do begin S:=S+1/(2*i*i); i:=i+1; end; write(‘S= ‘,s:2:2); readln end. Bình luận
uses crt;var i,n:longint; s:real;beginclrscr; write(‘n=’);readln(n); i:=1; if n>1 then s:=1/2; while i<n do begin inc(i); s:=s+1/(2*i*i); end; writeln(‘S= ‘,s:0:2);readlnend. Bình luận
program tinhtong;
Uses crt;
var S:real;
n,i:inteegr;
begin
clrscr;
write(‘Nhap n: ‘); readln(n);
S:=0; i:=1;
while i<=n do
begin
S:=S+1/(2*i*i);
i:=i+1;
end;
write(‘S= ‘,s:2:2);
readln
end.
uses crt;
var i,n:longint; s:real;
begin
clrscr;
write(‘n=’);readln(n);
i:=1;
if n>1 then s:=1/2;
while i<n do
begin
inc(i);
s:=s+1/(2*i*i);
end;
writeln(‘S= ‘,s:0:2);
readln
end.