Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5. double a,b,c;
  6. double delta;
  7.  
  8. do {
  9. printf("podaj wpolczynniki a b c:\n");
  10.  
  11. printf("A =");
  12. scanf("%f", a);
  13. printf("B =");
  14. scanf("%f", b);
  15. printf("C =");
  16. scanf("%f", c);
  17. printf("funkcja ma postać: %fx^2 + %fx + c\n", a,b,c);
  18.  
  19. delta = b * b - 4 * (a * c);
  20.  
  21. if(delta <= 0){
  22. printf("Delta ujemna podaj jeszcze raz!!\n");
  23. }
  24.  
  25. }while(delta <= 0);
  26.  
  27. float x1,x2;
  28.  
  29. x1 = (float) ((-b - sqrt(delta)) / (2 * a));
  30. x2 = (float) ((-b + sqrt(delta)) / (2 * a));
  31.  
  32. printf("miejsca zerowe: %f %f\n",x1,x2);
  33.  
  34. for(float index = x1; index <= x2; index=index + 0.01){
  35. float var = (a*(index*index) + b * index + c);
  36.  
  37. printf("F(%f) = %f\n",index, var);
  38. }
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement