Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void task2() {
- double e;
- int i = 1, x;
- int powerX = 1, power = 2;
- int fact = 1;
- double currentValueOfF = 0, sum = 0;
- printOnNewLine("Введите x: ");
- scanf("%d", &x);
- printOnNewLine("Введите e: ");
- scanf("%lf", &e);
- do
- {
- double divider = (cos(fact)) * i;
- if(divider != 0) {
- currentValueOfF = power / divider;
- sum += currentValueOfF;
- }
- fact *= i;
- printf("i is %d", i);
- powerX *= x;
- power = calculatePower(2, powerX);
- i++;
- } while (currentValueOfF > e);
- printf("approximate sum is %lf", sum);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement