Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int n, t, j;
- double h, b, a, x, f, min, max;
- cout << "enter n = ";
- cin >> n;
- cout << "enter h = ";
- cin >> h;
- cout << "enter b = ";
- cin >> b;
- for (t = 1;t <= 3;t++)
- {
- cout << "enter a" << t << " = ";
- cin >> a;
- j = 1;
- x = b + j * h;
- f = ((1 - a) / (1 + x * x))*sin(a*a + a * x + 2);
- min = f;
- max = f;
- for (j = 2;j <= n;j++)
- {
- x = b + j * h;
- f = ((1 - a) / (1 + x * x))*sin(a*a + a * x + 2);
- if (f < min)
- min = f;
- if (f > max)
- max = f;
- }
- cout << "fi = " << min << endl;
- cout << "psi = " << max << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement