Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<Math.h>
- #include "stdafx.h"
- long double Fx_count(double x, double eps = 1e-10) {
- long double sum = -1.0*x;
- long double Current = 3*x*x;
- int Number = 1;
- int iteration= 1;
- while (fabs(Current)>eps) {
- if (iteration % 3 == 0) {
- printf_s("\n\tNumber=%d\n\tsum=%lg\n\tCurrent=%lg\n", Number, sum, Current);
- }
- sum += Current;
- Current = Current * (-1.0)*(x*x*x*x*x*x*9)/((Number+1)*(Number+2));
- Number += 2;
- iteration++;
- }
- return sum;
- }
- int main() {
- double x;
- printf_s("Write argument\nx=");
- scanf_s("%lg", &x);
- printf_s("\nResult is:\n\ConsoleApplication4 %lg \n\tBy C functions= %lg\n", Fx_count(x), sin(3*x*x*x)/x - x+1);
- int stoppie;
- scanf_s("%d", &stoppie);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement