Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <complex>
- #include <cstring>
- using namespace std;
- int main() {
- int n;
- double y,x,step, min=INT_MAX, res;
- cout << "How much portions ";
- cin >> n;
- cout << "Enter step ";
- cin >> step;
- x = 2-step;
- for(int i= 0; i<n; i++){
- x+=step;
- y = log10(cosh(x))-tanh(x)+0.5;
- if(min > y){
- min = y;
- res = x;
- }
- }
- cout << "The min value is "<<min<<" The answer is "<< res<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement