Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- using namespace std;
- long double fact(int N)
- {
- if(N < 0)
- return 0;
- if (N == 0)
- return 1;
- else
- return N * fact(N - 1);
- }
- void main() {
- double a = 0.0;
- double b = 0.0;
- double n = 0.0;
- double y = 0.0;
- double k = 10.0;
- double x = 0.0;
- double s = 0.0;
- setlocale(LC_ALL, "Russian");
- cout<<"Введите a: ";
- cin>>a;
- cout<<endl;
- cout<<"Введите b: ";
- cin>>b;
- cout<<endl;
- cout<<"Введите n: ";
- cin>>n;
- cout<<endl;
- for(x=a;x<b;x+=(b-a)/k){
- y = sin(x)/x;
- s = pow(x, 2.0*n+1.0)/fact(2.0*n+1.0);
- cout<<"x = "<<x<<"\t y = "<<y<<"\t s = "<<s<<endl;
- }
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement