daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <math.h>
  3. #define NUM 108
  4.  
  5. double  startX, deltaX, endX;
  6.  
  7. double function1(double x) {
  8.   return log(1 - NUM / sin(x));
  9. }
  10.  
  11. double function2(double x) {
  12.   return tan(x) / NUM;
  13. }
  14.  
  15.  
  16. double decideFUNC(){
  17.   double x, f1, f2;
  18.   for(x = startX; x <= endX; x += deltaX) {
  19.     f1 = function1(x);
  20.     f2 = function2(x);
  21.     if (f1 == f2) { // вряд ли мы сюда попадем
  22.       printf("max values are the same %fn", f1);
  23.     } else {
  24.       if (f1 > f2)
  25.         printf("x = %f, f1 = %f (%f, %f)n", x, f1, f1, f2);
  26.       else
  27.         printf("x = %f, f2 = %f (%f, %f)n", x, f2, f1, f2);
  28.     }
  29.   }
  30. }
  31.  
  32. int main()
  33. {
  34.   scanf("%f", &startX);
  35.   deltaX = 4;
  36.   endX = 100;
  37.   decideFUNC();
  38.   return 0;
  39. }
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