Limad


SUBMITTED BY: Guest

DATE: Dec. 30, 2013, 3:23 a.m.

FORMAT: Text only

SIZE: 760 Bytes

HITS: 1062

  1. #include<stdio.h>
  2. #include<math.h>
  3. main()
  4. {
  5. float delta,x1,x2,a,b,c;
  6. printf(" gia tri a : \n");
  7. scanf("%f",&a);
  8. printf(" gia tri b : \n");
  9. scanf("%f",&b);
  10. printf(" gia tri c : \n");
  11. scanf("%f",&c);
  12. delta=b*b-4*a*c;
  13. if(a==0)
  14. {
  15. printf(" phuong trinh co nghiem duy nhat X=%f\n",-c/b);
  16. }
  17. else
  18. {
  19. if(delta<0)
  20. {
  21. printf(" phuong trinh vo nghiem ");
  22. }
  23. if(delta==0)
  24. {
  25. printf(" phuong trinh co nghiem kep X1=X2= %f\n",-b/(2*a));
  26. }
  27. if(delta>0)
  28. {
  29. printf(" phuong trinh co hai nghiem phan biet :\n");
  30. printf(" X1=%f\n",(-b-sqrt(delta))/(2*a));
  31. printf(" X2=%f\n",(-b+sqrt(delta))/(2*a));
  32. }
  33. }
  34. }

comments powered by Disqus