#24122: c語言


jz46946@gmail.com (James JSY)


#include<stdio.h>

int main(){

int a, b, c;

while(scanf ("%d%d%d",&a,&b,&c)!=EOF){

float D;

D = b*b-4*a*c;

if(D > 0){

int x1, x2;

x1 = (-b+sqrt(D))/(2*a);

x2 = (-b-sqrt(D))/(2*a);

printf("Two different roots x1=%d , x2=%d\n", x1, x2);

}

if(D == 0){

int x3;

x3 = -b/(2*a);

printf("Two same roots x=%d\n", x3);

}

if(D < 0){

printf("No real root\n");

}

}

return 0;

}