Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5.     double a, b, x, f1, f2, f3;
  6.     int n;
  7.     printf("vvedite a,b,x\n");
  8.     scanf("%lf %lf %lf", &a, &b, &x);
  9.     printf("vvedite n\n");
  10.     scanf("%i", &n);
  11.     switch (n) {
  12.  
  13.         case 1:
  14.             if (x != 0) {
  15.                 f1 = (a * b / tan(x));
  16.                 printf("%f", f1);
  17.             } else {
  18.                 printf("net reshenia");
  19.             }
  20.             break;
  21.  
  22.         case 2:
  23.             if (x != 0 && a != 0 && b != 0) {
  24.                 f2 = (a * b / tan(x)) / (tan(x) + fabs(a * b));
  25.                 printf("%f", f2);
  26.             } else {
  27.                 printf("net reshenia");
  28.             }
  29.             break;
  30.  
  31.         case 3:
  32.             if (x != 0 && a > 0 && b != 0) {
  33.                 f3 = (a * b / tan(x)) / (log(a) + fabs(b - x));
  34.                 printf("%f", f3);
  35.             } else {
  36.                 printf("net reshenia ");
  37.             }
  38.             break;
  39.         default:
  40.             printf("nepravilniy n");
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement