fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. float a, b, x;
  5. printf("Nhap a, b: ");
  6. scanf("%f%f", &a, &b);
  7.  
  8. if (a == 0) {
  9. if (b == 0)
  10. printf("Phuong trinh co vo so nghiem\n");
  11. else
  12. printf("Phuong trinh vo nghiem\n");
  13. } else {
  14. x = -b / a;
  15. printf("Nghiem cua phuong trinh la x = %.2f\n", x);
  16. }
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
Nhap a, b: Nghiem cua phuong trinh la x = 0.00