constk

Just_If

Oct 16th, 2019
204
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <iostream>
  4. #include "math.h"
  5.  
  6. int main() {
  7. setlocale(0, "Russian");
  8. float x, y;
  9. printf("Введите x > ");
  10. scanf("%f", &x);
  11.  
  12. if (x <= 9 && x >= -5) {
  13. if (x <= -3) {
  14. y = (-x) + 3;
  15. }
  16. if (x <= 0 && x > -3) {
  17. y = sqrt(9 - x * x);
  18. }
  19. if (x <= 6 && x > 0) {
  20. y = (-x / 2) + 3;
  21. }
  22. if (x > 6) {
  23. y = x - 6;
  24. }
  25. printf("y(%2.2f) = %2.2f\n", x, y);
  26. }
  27. else {
  28. printf("Функция не определена для x = %2.2f\n", x);
  29. }
  30.  
  31. system("pause");
  32. return 0;
  33. }
RAW Paste Data