Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Задание 2.
- */
- #include <cmath>
- #include <iomanip>
- #include <iostream>
- using namespace std;
- int main() {
- size_t n;
- cin >> n;
- if (n == 0) {
- cout << "The division by 0 operation is not possible";
- return 0;
- }
- double result = 0;
- double sin_sum = 0;
- for (int i = 1; i <= n; ++i) {
- sin_sum += sin(i);
- result += cos(i) / sin_sum;
- }
- const int PRECISION = 15;
- cout << fixed << setprecision(PRECISION) << result;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement