Chủ Nhật, 26 tháng 6, 2022

TONG5 C++

#include <bits/stdc++.h>
using namespace std;

int n;
float s;
int main()
{
    freopen("tong5.inp","r",stdin);
    freopen("tong5.out","w",stdout);
    cin>>n;
    s=0;
    for (int i=0;i<=n;i++) 
        s=s+(float(2*i+1))/(2*i+2);
    cout<<fixed<<setprecision(2);
    cout<<s;
}

Không có nhận xét nào:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.