githubNonFunziona/2-3-g.spp

12 lines
207 B
Plaintext
Raw Permalink Normal View History

2024-12-05 10:57:14 +00:00
#include <iostream>
int main() {
int a;
std::cin >> a;
double b = 1;
double c = 0.0;
for (int i = 1; i <= a; ++i) {
c += b / i;
b = -b;
}
std::cout << c << "\n";
}