Limad


SUBMITTED BY: Guest

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

FORMAT: Text only

SIZE: 839 Bytes

HITS: 2987

  1. #include<conio.h>
  2. #include<stdio.h>
  3. #include<math.h>
  4. void main()
  5. {
  6. float a,b,c,d;
  7. printf(" Nhap a,b,c:");
  8. scanf("%f%f%f",&a,&b,&c);
  9. if(a==0)//bx+c=0
  10. if(b==0)//c=0
  11. if(c==0)
  12. printf("\n VSN!");
  13. else
  14. printf("\n VN!");
  15. else
  16. printf("\n PT co nghiem duy nhat:x=%6.2f\n",-c/b);
  17. else//a!=0
  18. {
  19. d=b*b-4*a*c;
  20. if(d==0)
  21. printf("\n Nghiem kep:x1=x2=%6.2f",-b/(2*a));
  22. else//d!=0
  23. if(d>0)
  24. printf("\n Co hai nghiem la x1=%6.2f va x2=%6.2f",(-b+sqrt(d))/(4*a),
  25. (-b-sqrt(d))/(4*a));
  26. else//d<0
  27. printf("\n PTVN!");
  28. }
  29. getch();
  30. }

comments powered by Disqus