#include <stdio.h>
#include <the cmath>
int main (void)
{
int = panduan. 1;
int = A. 1;
int B = 2;
int. 3 = C;
a float Delta = 10;
a float X1;
a float X2;
the while (== panduan. 1)
{
the printf ( "enter a quadratic equation aX2 + bX + c = 0 the coefficient \ n-.");
the printf ( "Please enter a value of the coefficient a: \ n-");
Scanf ( "% ; D ", & a)
\ n-");: enter the value of the coefficient b of the printf ( "
Scanf ("% D ", & b);
the printf (" Please enter the coefficient value of c: \ n-");
Scanf ("% D ", & C);
the printf (" a quadratic equation you entered is:% dX2 +% dX +% D = 0 \ n-", a, B, C);
Delta = B * B -. 4 * a * C;
IF (delta>0)
{
x1 = (-b + sqrt(delta)) / 2*a;
= X2 (-b - sqrt (Delta)) / 2 * A;
the printf ( "Enter your quadratic solution monohydric is: \ n-");
the printf ( "% X1 = F \ n-", X1);
the printf ( "F X2 =% \ n-", X2);
the printf ( "Solution end \ n-");
}
IF (== 0 Delta)
{
X1 = -b / 2 * A;
X2 = -b / 2 * A;
printf ( "enter your quadratic solution monohydric is: \ n-");
printf ( "X1 = X2 = F% \ n-", X1);
printf ( "solution end \ n-");
}
IF (Delta < 0)
{
printf ( "You entered one yuan quadratic equation has no solution \ the n-.");
printf ( "solving the end of \ the n-.");
}
printf ( "Please continue to do your will continue after 1 enter input? Please enter enter exit 0, \ n-");
Scanf ("% D ", & panduan);
}
return 0;
}
C language learning DAY3 a quadratic equation preliminary version
Guess you like
Origin www.cnblogs.com/bourne1980/p/11688703.html
Recommended
Ranking