Traditional Culture Encyclopedia - Traditional festivals - C language, the flow chart of finding the root of equation ax2+bx+c=0, (note the difference between real root sum and no real root)
C language, the flow chart of finding the root of equation ax2+bx+c=0, (note the difference between real root sum and no real root)
# include & ltmath.h & gt
# include & ltstdio.h & gt
void main()
{load a, b, c, dt;
Printf ("enter a, b, c:");
Scanf("%f, %f, %f, & ampb & amp;; c);
If (a= =0)
If (b= =0)
Printf ("\ nThis is not an equation!" );
other
Printf ("\ nThere is only one root, which is:% f"-c/b);
other
{ dt = b * b-4.0 * a * c;
if(dt & gt; =0.0)
{ dt = sqrt(dt);
Printf ("The two roots are: %f, %f", (-b+dt)/(2 * a));
}
other
Printf ("no root");
}
}
- Previous article:Relationship Chart of the Eight Great Poets of Tang and Song
- Next article:What are the basic dance moves?
- Related articles
- 15 Marketing Strategies
- What is the significance and purpose of the intangible cultural heritage of tea?
- What is the interview form of national civil servants?
- Why are the ratings of traditional dramas getting lower and lower?
- What should we pay attention to in bookstore design?
- Can a switch be converted to an outlet?
- The most effective formula to lure shrimps into cages
- What are the characteristics of the Tang suit?
- Color energy category-know your five-element exclusive energy color
- Who are the seven fairies?