Skip to content
Snippets Groups Projects
Commit 0768a7ef authored by Jakub Walas's avatar Jakub Walas
Browse files

Upload New File

parent 2413dc68
Branches
No related merge requests found
#include <stdio.h>
#include <math.h>
#include <complex.h>
int main (){
float a,b,c,e;
complex z1,z2;
printf("Podaj wspolczynnik a\n");
scanf("%f",&a);
printf("Podaj wspolczynnik b\n");
scanf("%f",&b);
printf("Podaj wspolczynnik c\n");
scanf("%f",&c);
printf("%.1f*x^2+%.1f*x+%.1f=0\n",a,b,c);
if (a==0 && b==0.0 && c==0){
printf("Rownanie nieoznaczone");
return 0;
}
else if (a==0.0 && b==0){
printf("Rownanie sprzeczne");
return 0;
}
else if (a==0.0){
printf("Rownanie liniowe\n");
}
else{
printf("Rownanie kwadratowe\n");
}
if (a==0.0){
printf("Rozwiazaniem jest %.1f",-c/b);
return 0;
}
e=b*b-4*a*c;
if(e==0){
printf("Wynikiem rownania jest %.1f",-b/(2*a));
return 0;
}
else if (e<0){
printf("x1= %.1f%.1fi\n",(-b)/(2*a),(-sqrtf(-e)));
printf("x2= %.1f+%.1fi",(-b)/(2*a),(sqrtf(-e)));
return 0;
}
printf("Wynikami rownania sa %.1f i %.1f",(-b+sqrt(b*b-4*a*c))/(2*a),(-b-sqrt(b*b-4*a*c))/(2*a));
return 0;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment