Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. double Func(double x, double a, double b, double c)
  4. {
  5.     if (a < 0 && x != 0)
  6.         return a*x*x + b * b*x;
  7.     else if (a > 0 && x == 0)
  8.         return x - a / (x - c);
  9.     else
  10.         return 1 + x / c;
  11. }
  12.  
  13. void main()
  14. {
  15.     double a, b, c, x; int i;
  16.  
  17.     do
  18.     {
  19.         x = -5;
  20.         printf("Write a, b, c: \n");
  21.         scanf("%lf%lf%lf", &a, &b, &c);
  22.  
  23.         for (x; x < 5; x = x + 0.5)
  24.         {
  25.             printf("Result : %lf\n", Func(x, a, b, c));
  26.         }
  27.         printf("Continue?\n");
  28.         scanf("%d", &i);
  29.     } while (i);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement