#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
int a,b,c;
long i,j,k,l,z;
while( scanf("%d %d %d",&a,&b,&c)!=EOF )
{
i=((b*b)-(4*a*c));
j=sqrt(i);
if(j==0){
printf("Two same roots x=%d\n",z=-b/(a*a));
}
else if(j>0){
k=((-b+j)/(2*a));
l=((-b-j)/(2*a));
printf("Two different roots x1=%d , x2=%d\n",k,l);
}
else{
printf("No real root\n");
}
}
return 0;
}
#include
#include
#include
int main(void)
{
int a,b,c;
long i,j,k,l,z;
while( scanf("%d %d %d",&a,&b,&c)!=EOF )
{
i=((b*b)-(4*a*c));
j=sqrt(i);
if(j==0){
printf("Two same roots x=%d\n",z=-b/(a*a));
}
else if(j>0){
k=((-b+j)/(2*a));
l=((-b-j)/(2*a));
printf("Two different roots x1=%d , x2=%d\n",k,l); <----------------------- PS: ...,若有兩個根則大者在前
}
else{
printf("No real root\n");
}
}
return 0;
}