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.
#include <bits/stdc++.h>
using namespace std;
long long i,n;
double s;
int main()
{
cin>>n;
s=0;
for (i=1; i<=n; i++)
s=s+((1*1.0)/(2*(i*1.0+1*1.0)));
cout<<fixed<<setprecision(2)<<s;
return 0;
}
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.
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.
uses crt;
var n,i,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
i:=1;
while i<=n do
begin
s:=s+i;
inc(i);
end;
writeln(s);
readln;
end.
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.
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.
*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.
-Python:
n=int(input('n= '))
t=0
for i in range(1,2*n):
if i%2!=0:
t+=i**3
print('Tong=',t)
#include <bits/stdc++.h>
using namespace std;
long long i,n,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=2*n; i++)
if (i%2!=0) t+=pow(i,3);
cout<<t;
return 0;
}
Bài 1:
uses crt;
var n,i:integer;
s:real;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+1/(2*i+1);
writeln(s:4:2);
readln;
end.
1:
uses crt;
var n,i,t:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=1 to n do
t:=t+i*i;
write(t);
readln;
end.
2
program bt2;
var i,n,t:integer;
begin
readln(n);
s:=0;
for i:=1 to n do
if i mod 2 = 1 then s:=s+i;
readln;
end.
Program tinhtong;
Var n,s,i: integer;
Begin
Write('Hay nhap gia tri cua n'); Readln(n);
s:=0;
For i:=1 to n do s:=1/(2*i+1);
Write('Vay gia tri cua S la: ',s);
End.