oj1
#include <stdio.h> #include <math.h> int main() { float a,b,c; float disc,x1,x2,realpart,imagpart; printf("\n"); scanf("%f %f %f",&a,&b,&c); printf("\n"); if(a==0) { if(b==0&&c!=0)printf("\n"); else if(b==0&&c==0)printf("Error!\n"); else printf("%f\n",(-c)/b);} else { disc=b*b-4*a*c; if(disc==0) printf("x1=x2=%f\n",(-b)/(2*a)); else if(disc>0) { x1=(-b+sqrt(disc))/(2*a); x2=(-b-sqrt(disc))/(2*a); printf("x1=%.6f\n",x1); printf("x2=%.6f\n",x2); } else { realpart=-b/(2*a); imagpart=sqrt(-disc)/(2*a); printf("\n"); printf("No solution!"); } } }