Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <stdio.h>
- int main(){
- float a,b,c, x, d, ds, pom, x1, x2;
- printf("a=");
- scanf("%f",&a);
- printf("b=");
- scanf("%f",&b);
- printf("c=");
- scanf("%f",&c);
- if(a==0)
- {
- if(b==0)
- {
- if(c==0)
- {
- printf("tozsamosc\n");
- } else
- {
- printf("sprzecznosc\n");
- }
- }
- else
- {
- x=-c/b;
- printf("x=%f\n",x);
- }
- }
- else
- {
- d=b*b-4*a*c;
- if(d>0)
- {
- ds=sqrt(d)/(2*a);
- pom=(-b)/(2*a);
- x1=pom-ds;
- x2=pom+ds;
- printf("x1=%f, x2=%f\n", x1, x2);
- }
- else if(d==0)
- {
- x=(-b)/(2*a);
- printf("x=%f\n", x);
- }
- else
- {
- printf("nie ma miejsc zerowych");
- }
- }
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement