Guest User

Untitled

a guest
Feb 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <stdio.h>
  3. #include <conio.h>
  4.  
  5. float GetValueFunction(float a, float b);
  6. void main()
  7. {
  8. float x,y;
  9. printf("input koordinati /n");
  10. printf("input x:");
  11. scanf("%f", &x);
  12. printf("input y:");
  13. scanf("%f", &y);
  14. float k=GetValueFunction(x,y);
  15. float y1,y2,y3,a;
  16. y1 = a+2;
  17. y2=(-a)*2+2;
  18. y3=0.5*a-1;
  19. printf("part=%1.0f\n", k);
  20.  
  21.  
  22. getch();
  23. }
  24. float GetValueFunction(float a, float b )
  25. {
  26. float c=0;
  27. float y1, y2,y3;
  28. if ((b <= y1) && (b <= y2) && (b >= y2))
  29. c = 0;
  30. else if (b >= (y1) && b >y2)
  31. c = 1;
  32. else if (b >= y3)
  33. c = 6;
  34. else c = 5;
  35. else if (b >= y3)
  36. c = 2;
  37. else if (b > y2)
  38. c = 3;
  39. else c = 4;
  40. return c;
  41. }
Add Comment
Please, Sign In to add comment