Friday, October 7, 2022

sin(x)

 #include <iostream>
#include <math.h>
using namespace std;
int main()
{
double x,s,a,b,c;
int k; k = -1;
cin >> x;
cout << x << " " << sin(x) <<" ";
s = x; a = x*x; b = 1; c = x*x*x/6;
for (int i = 3; i < 1000; i+=2)
{
s = s + k* c;
c = c * a;
c = c / ((i + 1)*(i+2));
k = k * -1;
}
cout << s << "\n";
}

No comments:

Post a Comment

NaCl.xyz Generator with Interactive 3D Visualization

NaCl.xyz Generator with Interactive 3D Visualization NaCl.xyz Generator with Interactive 3D Visualization ...