+ 1
Who can help me? I want to write if(b==0 && c==0) { printf("x=0"); } but when I write this my program don't work!
12 Answers
+ 6
There is mistake in a*x*x=0
Because this is rule in c that only one variable should be on left of the assignment operator(=).
So a*x*x=0 is not possible because it is invalid
+ 2
Try to use double in place of float. Comparison of float value against a literal (such as 0) usually fails due to the fact that the literal 0 is by default a double type value. Difference of precision accuracy between float and double is the cause, most of the times.
+ 1
Erik Margaryan
To be honest I don't think I'm understanding your code. Maybe it's because I'm no good in math. Can you tell me what exactly is this code doing? maybe I can help further if I can understand it (hope so).
+ 1
ax²+bx+c=0
a,b,c are constant.
When a=0 => x = -c/b and b â 0,
When b=0 => ax²+c=0, x²=-c/a, x1, x2 = Âąâ(-c)/a => c or a have to less than 0 and a â 0.
When c=0 => ax² +bx=0, x(ax+b)=0 => x1=0 and x2=(-b)/a and aâ 0.
Discriminate means 'D' symbol..
When aâ 0 and bâ 0 and câ 0 then
D=b²+4ac,
When D<0 then x=ø,
When D>0 then
X1, X2 = (-b Âą âD)/2a
This is "Square Equation". You can search Square Equation by Google for understand better!
Now I want to write when b=0 and c=0 => ax² = 0 => x=0. But my program don't work!
+ 1
Thanks Erik Margaryan ,
I think I should've learn that square equation first before I commented XD
I hope someone knowledgeable sees your post and help you with it.
Good luck! đ
0
But who can answer me which line to write that? if(b==0 && c==0) {
printf("x=0");
}
0
I write that different lines and output is:
X=0
X_1=.....
X_2=....
.....
But I need only x=0.
0
Thanks!! I hope too.
0
Sees my program again! I already find my error.đĽł
0
Ůبؾ
0
See of my program more improve version!đ