Advertisement
Guest User

zad4

a guest
Mar 22nd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1.  
  2. #define _CRT_SECURE_NO_WARNINGS
  3.  
  4. #include <stdio.h>
  5. #include <math.h>
  6. #include <time.h>
  7. #include <conio.h>
  8. #include <stdlib.h>
  9. double  f(double, int *);
  10. int main() {
  11.  
  12.     double x;
  13.     int * kod = 0;
  14.    
  15.     do {
  16.         scanf("%lf", &x);
  17.         printf("%lf", f(x, &kod));
  18.         printf("\n %d", kod);
  19.     } while (kod != -1);
  20.     _getch();
  21.     _getch();
  22.  
  23. }
  24. double f(double x, int *kod) {
  25.     if (x > 0) {
  26.         *kod = 1;
  27.         return x = x * (sin(log(x)) + cos(log(x)));
  28.     }
  29.     else {
  30.         *kod = -1;
  31.             return 0;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement