fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6. int a, b, c;
  7. float delta,pierw;
  8. float x, x1, x2;
  9. printf("Podaj wspolczynniki rownania kwadratowego:");
  10. scanf_s("%d%d%d", &a, &b, &c);
  11. delta = (b * b) - (4 * a * c);
  12. pierw = sqrt(delta);
  13. if (a == 0) {
  14. printf("To nie jest rownanie kwadratowe!");
  15. }
  16. else {
  17. if (delta < 0) {
  18. printf("Brak pierwiastkow!");
  19. }
  20. if (delta == 0) {
  21. x = -b / (2 * a);
  22. printf("%s %f", "Rownanie ma jedno rozwiazanie rowne:", x);
  23. }
  24. if (delta > 0) {
  25. x1 = (-b + pierw) / (2 * a);
  26. x2 = (-b - pierw) / (2 * a);
  27. printf("Rownanie ma dwa rozwiazania:");
  28. printf("%s %f", "x1 = ",x1);
  29. printf("%s %f", " x2 = ",x2);
  30.  
  31. }
  32. return 0;
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:10:5: warning: implicit declaration of function ‘scanf_s’; did you mean ‘scanf’? [-Wimplicit-function-declaration]
     scanf_s("%d%d%d", &a, &b, &c);
     ^~~~~~~
     scanf
prog.c:33:1: error: expected declaration or statement at end of input
 }
 ^
stdout
Standard output is empty