Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int f(int x)
  4. {
  5. if(x>0)
  6. return x*x-7*x+4;
  7. else return x*x-x+9;
  8. }
  9. int g(int x,int y)
  10. {
  11. if(x>0 && y<0)
  12. return 2*x-5*y+1;
  13. else return x+9*y+1;
  14. }
  15. int h(int x)
  16. {
  17. if(x==0)
  18. return 0;
  19. else return x+7*h(x-1)+4;
  20. }
  21. int m(int x)
  22. {
  23. if(x==0)
  24. return 1;
  25. else return 2*m(x-1);
  26. }
  27. int main()
  28. { int a,b,c,d;
  29. a=f(5);
  30. b=g(2,3);
  31. c=h(1);
  32. d=m(2);
  33. printf("functia f este:%d\n",a);
  34. printf("functia g este:%d\n",b);
  35. printf("functia h este:%d\n",c);
  36. printf("functia m este:%d",d);
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement