Maszi

Untitled

Oct 13th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 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, x1,x2;
  8. printf("Podaj a,b,c \n");
  9. scanf("%f", &a);
  10. scanf("%f", &b);
  11. scanf("%f", &c);
  12.  
  13. float delta = pow(b,2) - (4*a*c);
  14.  
  15. if(a==0){
  16.     printf("To nie jest rownanie kwadratowe");
  17. } else if (delta>0){
  18.     x1 = (-b - sqrt(delta))/(2*a);
  19.     x2 = (-b + sqrt(delta))/(2*a);
  20.     printf("Istnieja 2 miejsca zerowe: %.2f i %.2f", x1, x2);
  21. } else if (delta==0){
  22.     x1 = (-b)/(2*a);
  23.     printf("Istnieje 1 miejsce zerowe %.2f", x1);
  24. } else {
  25.     printf("Delta ujemna, brak miejsc zerowych... narazie ;)");
  26. }
  27.     return 0;
  28. }
Add Comment
Please, Sign In to add comment