Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include "pch.h"
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <iostream>
  5. #define _USE_MATH_DEFINES
  6. #include <math.h>
  7. #ifdef _MSC_VER
  8. #define _CRT_SECURE_NO_WARNINGS
  9. #endif
  10. int main()
  11. {
  12.     int x, x1, x2, mn;
  13.     float f1, f2, min, max;
  14.     mn = 39;
  15.     printf("ENTER X1: ");
  16.         scanf("%i", &x1);
  17.     printf("\n");
  18.  
  19.     printf("ENTER X2: ");
  20.     scanf("%i", &x2);
  21.     printf("\n");
  22.  
  23.     if (x1 > x2) {
  24.         printf("ERROR input");
  25.         return NULL;
  26.     }
  27.  
  28.     //grid
  29.     printf("#\t");
  30.     printf("X\t");
  31.     printf("MAX\n");
  32.     printf("____________________________\n");
  33.  
  34.     for (int i = 0; i < x2 - x1; i++) {
  35.         printf("%d:\t", i + 1);
  36.         x = i + x1;
  37.         printf("%d\t", x);
  38.         if ((1 - mn) / sin(x) > 0 && sin(x) != 0) {
  39.             f1 = log10((1 - mn) / sin(x));
  40.         }
  41.         else {
  42.             printf("ERROR log\n");
  43.             continue;
  44.         }
  45.         if (fmod(x, M_PI_2) != 0 && x != 0) {
  46.             f2 = fabs(1 / tan(x) * mn);
  47.         }
  48.         else {
  49.             printf("ERROR Abs\n");
  50.             continue;
  51.         }
  52.  
  53.         max = fmax(f1, f2);
  54.         printf("%f\n", max);
  55.     }
  56.  
  57.     printf("\nEND");
  58.     return NULL;
  59.  
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement