Guest User

Untitled

a guest
Dec 5th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<math.h>
  4.  
  5. int main()
  6. {
  7. float a,b,c,delta,x1,x2,x3,x0;
  8.  
  9. printf("Poda a: ");
  10. scanf("%f",&a);
  11. printf("Poda b: ");
  12. scanf("%f",&b);
  13. printf("Poda c: ");
  14. scanf("%f",&c);
  15.  
  16. if(a==0 && b!=0){
  17. x0 = -c/b;
  18. printf("x3=%.2f\n",x3);
  19. }
  20. if(a==0 && b==0 && c!=0){
  21. printf("Brak rozwiazan \n");
  22. }
  23. if(a==0 && b==0 && c==0) {
  24. printf("Nieskonczenie wiele rozwiazan\n");
  25. }
  26. if(a!=0)
  27. {
  28. delta=(b*b)-4*a*c;
  29. if(delta<0) printf("Brak rozwiazan \n");
  30. if(delta==0){
  31. x0=(-b-sqrt(delta))/(2*a);
  32. printf("x0=%.2f\n",x0);
  33. }
  34.  
  35. if(delta>0)
  36. {
  37. x1=(-b-sqrt(delta))/(2*a);
  38. x2=(-b+sqrt(delta))/(2*a);
  39. printf(" x1=%.2f\n x2=%.2f\n",x1,x2);
  40. }
  41. }
  42. system("PAUSE");
  43. return 0;
  44. }
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment