Advertisement
Nexon

Untitled

Dec 9th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. long double fact(int N)
  8. {
  9.     if(N < 0)
  10.         return 0;
  11.     if (N == 0)
  12.         return 1;
  13.     else
  14.         return N * fact(N - 1);
  15. }
  16.  
  17. void main() {
  18.     double a = 0.0;
  19.     double b = 0.0;
  20.     double n = 0.0;
  21.     double y = 0.0;
  22.     double k = 10.0;
  23.     double x = 0.0;
  24.     double s = 0.0;
  25.  
  26.     setlocale(LC_ALL, "Russian");
  27.  
  28.     cout<<"Введите a: ";
  29.     cin>>a;
  30.     cout<<endl;
  31.  
  32.     cout<<"Введите b: ";
  33.     cin>>b;
  34.     cout<<endl;
  35.  
  36.     cout<<"Введите n: ";
  37.     cin>>n;
  38.     cout<<endl;
  39.  
  40.     for(x=a;x<b;x+=(b-a)/k){
  41.         y = sin(x)/x;
  42.         s = pow(x, 2.0*n+1.0)/fact(2.0*n+1.0);
  43.  
  44.         cout<<"x = "<<x<<"\t y = "<<y<<"\t s = "<<s<<endl;
  45.     }
  46.  
  47.     system("PAUSE");
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement