#25713: 參考一下就好 不要照抄照抄

#### s910251@student.cysh.cy.edu.tw (吳亮佑)

School : 國立嘉義高級中學
ID : 145844
2021-04-26 20:52:21
a009. 解碼器 -- | From: [36.232.101.212] | Post Date : 2021-06-16 08:51

#include <stdio.h>

#include <math.h>

int main()

{

int a,b,c,d;

int x1,x2,x3;

scanf("%d%d%d",&a,&b,&c);

d=(b*b)-(4*a*c);

if(d>0)

{

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)

{

x3= -b/(2*a);

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

}

if(d<0)

{

printf("No real root\n");

}

return 0;

}

hi

#25723: Re:參考一下就好 不要照抄照抄

#### 71087@stu.cchs.chc.edu.tw (~ pythOnia ChallengeR ~)

School : 精誠中學
ID : 125595
2021-07-25 11:13:57
a009. 解碼器 -- | From: [114.42.204.46] | Post Date : 2021-06-17 09:37

#include

#include

int main()

{

int a,b,c,d;

int x1,x2,x3;

scanf("%d%d%d",&a,&b,&c);

d=(b*b)-(4*a*c);

if(d>0)

{

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)

{

x3= -b/(2*a);

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

}

if(d<0)

{

printf("No real root\n");

}

return 0;

}

hi

ZeroJudge Forum