Viết chương trình tính tổng 1/3 + 2/5 + 3/7 + ...+ n/(2n+1)

Example code

/// C++ program to find the sum of the 
// series 1/3 + 2/5 + 3/7 +... 

#include <iostream> 
using namespace std; 

// Function to find the sum of the 
// given series 
float printSumSeries(int N) 
{ 
	// Intialise the sum to 0 
	float sum = 0; 

	for (int i = 1; i <= N; i++) { 

		// Generate the ith term and 
		// add it to the sum 
		sum += 1.0 * i / (2 * i + 1); 
	} 

	return sum;
} 

// Driver Code 
int main() 
{ 
	int N = 7; 

	float sum = printSumSeries(N); 
	
	// Print the final sum 
	cout << sum << endl; 
	return 0; 
}