Advertisement
Guest User

liza sasi lalka

a guest
Dec 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.86 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. double func1(double x, double y)
  5. {
  6.     return pow(cos(x), 4) + pow(sin(y), 2) + pow(sin(2 * x), 2) / 4 - 1;
  7. }
  8.  
  9. double func2(double x, double y)
  10. {
  11.     return sin(y + x) * sin(y - x);
  12. }
  13.  
  14. void main()
  15. {
  16.     int i = 1, choice; double x = 0, y = 0;
  17.     do {
  18.         printf("Choose operation :\n1. Enter the numbers\n2. Calculation Z1 = cos^4(x) + sin^(2y) + sin^2(2x)/4 - 1\n");
  19.         printf("3. Calculation Z2 = sin(y + x) * sin(y - x)\n4. Exit\n");
  20.         scanf("%d", &choice);
  21.         switch (choice) {
  22.         case 1: {
  23.             printf("Write x, y\n");
  24.             scanf("%lf%lf", &x, &y);
  25.         }
  26.                 break;
  27.         case 2: {
  28.             printf("Z1 = %lf\n", func1(x, y));
  29.         }
  30.                 break;
  31.         case 3: {
  32.             printf("Z2 = %lf\n", func2(x, y));
  33.         }
  34.                 break;
  35.         case 4: {
  36.             i = 0;
  37.         }
  38.                 break;
  39.         default: {
  40.             printf("Wrong variant\n");
  41.         }
  42.                 break;
  43.         }
  44.     } while (i);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement