SHARE
TWEET

Untitled

a guest Sep 20th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <math.h>
  3. #include <complex>
  4. #include <cstring>
  5. using namespace std;
  6.  
  7. int main() {
  8. int n;
  9. double y,x,step, min=INT_MAX, res;
  10. cout << "How much portions ";
  11. cin >> n;
  12. cout << "Enter step   ";
  13. cin >> step;
  14. x = 2-step;
  15.  
  16. for(int i= 0; i<n; i++){
  17.     x+=step;
  18.     y = log10(cosh(x))-tanh(x)+0.5;
  19.     if(min > y){
  20.         min = y;
  21.         res = x;
  22.     }
  23. }
  24.     cout << "The min value is  "<<min<<"   The answer is  "<< res<<endl;
  25.  
  26.     return 0;
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top