【资料图】
1、#include#includevoidmain(){floata,b,c,dlt;scanf("%f%f%f",&a,&b,&c);if(a){dlt=b*b-a*c*4;if(dlt>0)printf("x1=%.2fx2=%.2f",(-b+sqrt(dlt))/(a*2),(-b-sqrt(dlt))/(a*2));elseif(dlt<0)printf("x1=%.2f+%.2fix2=%.2f-%.2fi",-b/(a*2),abs(sqrt(-dlt)/(a*2)),-b/(a*2),abs(sqrt(-dlt)/(a*2)));elseprintf("x=%.2f",-b/(a*2));}else{if(b)c?printf("x=%.2f",-c/b):printf("x=%.2f",abs(-c/b));elsec?printf("NotAnEquation"):printf("ZeroEquation");}}。
本文到此分享完毕,希望对大家有所帮助。