Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <cstdlib>
- #include <cmath>
- #include <math.h>
- #include <iostream>
- using namespace std;
- void rek_r(double y0, double y1);
- int main() {
- double y0 = 0.5;
- double y1 = 0.25;
- rek_r(y0, y1);
- system("PAUSE");
- return 0;
- }
- void rek_r(double y0, double y1) {
- double sum;
- int i = 2;
- do {
- sum = (tanh(y0 * y1)) / i;
- //cout << i << " - " << sum << endl;
- i++;
- y0 = y1;
- y1 = sum;
- if (i > 50) {
- cout << "Rayd rashod";
- break;
- }
- } while (fabs(y0 - y1) > 0.0001);
- if (i < 50) {
- cout << "Rayd shod. Summa:" << sum;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement