Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <iostream>
- #define _USE_MATH_DEFINES
- #include <math.h>
- #ifdef _MSC_VER
- #define _CRT_SECURE_NO_WARNINGS
- #endif
- int main()
- {
- int x, x1, x2, mn;
- float f1, f2, min, max;
- mn = 39;
- printf("ENTER X1: ");
- scanf("%i", &x1);
- printf("\n");
- printf("ENTER X2: ");
- scanf("%i", &x2);
- printf("\n");
- if (x1 > x2) {
- printf("ERROR input");
- return NULL;
- }
- //grid
- printf("#\t");
- printf("X\t");
- printf("MAX\n");
- printf("____________________________\n");
- for (int i = 0; i < x2 - x1; i++) {
- printf("%d:\t", i + 1);
- x = i + x1;
- printf("%d\t", x);
- if ((1 - mn) / sin(x) > 0 && sin(x) != 0) {
- f1 = log10((1 - mn) / sin(x));
- }
- else {
- printf("ERROR log\n");
- continue;
- }
- if (fmod(x, M_PI_2) != 0 && x != 0) {
- f2 = fabs(1 / tan(x) * mn);
- }
- else {
- printf("ERROR Abs\n");
- continue;
- }
- max = fmax(f1, f2);
- printf("%f\n", max);
- }
- printf("\nEND");
- return NULL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement