Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- float a,b,c, x1,x2;
- printf("Podaj a,b,c \n");
- scanf("%f", &a);
- scanf("%f", &b);
- scanf("%f", &c);
- float delta = pow(b,2) - (4*a*c);
- if(a==0){
- printf("To nie jest rownanie kwadratowe");
- } else if (delta>0){
- x1 = (-b - sqrt(delta))/(2*a);
- x2 = (-b + sqrt(delta))/(2*a);
- printf("Istnieja 2 miejsca zerowe: %.2f i %.2f", x1, x2);
- } else if (delta==0){
- x1 = (-b)/(2*a);
- printf("Istnieje 1 miejsce zerowe %.2f", x1);
- } else {
- printf("Delta ujemna, brak miejsc zerowych... narazie ;)");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment