Defining a quadratic function rooting

#include <stdio.h> 
#include <math.h>
 // defines a quadratic function rooting function 
void qiugen ( a float A, a float B, a float C) {
 a float X, Y;
 IF (B * B < . 4 * a * C) 
the printf ( " the equation no real roots " );
 the else  IF (B * B == . 4 * a * C) { 
X = -b / ( 2 * a); 
the printf ( " this equation has a root F% " , X); 
} 
the else { 
X = (- B + sqrt (B * B- . 4 * A * C)) / (A * 2); 
Y = (- B-sqrt (B * B- . 4 * A * C)) / (A * 2 ); 
the printf ( " The function has two roots are:% f and F% " , X, Y); 
} 
return  0 ; 
} 

// verify 
int main () {
 a float a, b, c;
 the while ( . 1 ) { 
the printf ( " \ n-enter the value of a, b, c is: \ n- " ); 
Scanf ( " % F " , & A ); 
Scanf ( " % F " , & B); 
Scanf ( " % F " , &  C);
qiugen (A, B, C);
}
return 0;
}   
    

 

Guess you like

Origin www.cnblogs.com/gougouwang/p/11517266.html