Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- int N;
- double sum = 1.0;
- cout << "Введите N: ";
- cin >> N;
- for (int i = 2; i <= N; i++) {
- sum = sum + (1.0 / i);
- }
- cout << "Сумма равна: " << fixed << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment