Savelyev_Vyacheslav

Lab_2_СИ_5-вар

Aug 5th, 2020 (edited)
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.03 KB | None | 0 0
  1. #include <conio.h>
  2. #include <math.h>
  3. #include <stdio.h>
  4. #include <windows.h>
  5. main() {
  6.     SetConsoleCP(1251);
  7.     SetConsoleOutputCP(1251);
  8.     float x, z, a, b;
  9.     char Error_text[] = "NET resheniay";
  10.     printf("Vvedite a: ");
  11.     scanf("%f",&a);
  12.     printf("Vvedite b: ");
  13.     scanf("%f",&b);
  14.     printf("Vvedite x: ");
  15.     scanf("%f",&x);
  16.     if (x>0) {
  17.         if (x<=a) {z=log(x)+sin(x);}
  18.         else  {
  19.                 if ((a<x)&&(x<b)) {z=log(x)+cos(x);}
  20.                 else { z=tan(x); }
  21.                 printf("REZULTAT z = %f\n",z);
  22.     }
  23.             }
  24.     else if (x<0) {
  25.             if (x<a) {
  26.                 z=log(x)+sin(x);
  27.                 printf("ln(x) ne prenadlezhit oblasti znacheniya ot minus beskonechnosty do nulya  z = %f\n",z);
  28.                     printf("%s. stroka-28 cod",Error_text);
  29.             }
  30.         }
  31.    
  32.     else if ((a<x)&&(x<b)) {
  33.             z=log(x)+cos(x);
  34.             printf("ln(x) ne prenadlezhit oblasti znacheniya ot minus beskonechnosty do nulya  z = %f\n",z);
  35.                 printf("%s. stroka-35 cod",Error_text);
  36.         }
  37.     else {
  38.         z=tan(x);
  39.         printf("REZULTAT z = %f\n",z);
  40.     }
  41.    
  42.    return 0;
  43. }
Add Comment
Please, Sign In to add comment