Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int factorial(int value)
- {
- return (value < 2) ? (1) : (value*factorial(value - 1));
- }
- double Y(double x)
- {
- return exp(cos(x)) * cos(sin(x));
- }
- void S(float from, float to, int n)
- {
- int fact = 1;
- int multiplier = 1;
- float sum = 1;
- for (float i = from; i < to ; i += (to - from) / n )
- {
- printf("Y(%f) = %f\t\t", i, Y(i));
- sum += (cos(multiplier * i) / factorial(fact));
- printf("S(%f) = %f\n", i, sum);
- }
- }
- int main()
- {
- S(0.1, 1, 10);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement