Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- void RegCikl(double a, double b, double h, double& max, double& min ){
- double x,y;
- int n = ceil((b-a)/h)+1;
- for (int i = 1; i<=n; ++i){
- x = a+(i-1)*h;
- y = exp(3*x)-x*x;
- if(y>max) max = y;
- if(y<min) min = y;
- }
- }
- int main() {
- double a,b,h;
- double max = -1.7e308, min = 1.7e308;
- cin >> a >> b >> h;
- RegCikl(a,b,h,max, min);
- cout << max <<min;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement