Skip to content
Snippets Groups Projects
Commit a240aac3 authored by Mikołaj Suszek's avatar Mikołaj Suszek
Browse files

Upload New File

parent 800b64c8
Branches
No related merge requests found
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <complex.h>
int main()
{
printf("podaj liczby\n");
float a ;
float b ;
float c ;
scanf("%f %f %f", &a, &b, &c);
printf("Rownanie:\n %.2f x^2+ %.2f x+ %.2f \n", a, b, c);
if (a==0 && b==0 && c==0) {
printf("rownanie nieoznaczone\n");
}
else if (a==0 && b==0) {
printf("rownanie sprzeczne\n");
}
else if (a==0) {
printf("rownanie liniowe\n");
printf("Rozwiazanie rownania:\n %.2f\n", -c/b);
}
else {
printf("rownanie kwadratowe\n");
if ((b*b-4*a*c)>0){
printf("Rozwiazanie rownania:\n x1=%.2f\n", (b-sqrt(b*b-4*a*c))/2*a );
printf("x2=%.2f\n", (b+sqrt(b*b-4*a*c))/2*a);
}
else if ((b*b-4*a*c)==0) {
printf("Rozwiazanie rownania x=%.2f\n", b/2*a);
}
else if ((b*b-4*a*c)<0) {
printf("Rozwiazanie rownania x1=%.2f\n", csqrt((-b-(b*b-4*a*c))/2*a));
printf("x2=%.2f\n", csqrt((-b-(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