Newton iterative method is used to find the root of the equation f (x) = 0(

Newton iterative method is used to find the root of the equation f (x) = 0(


#include
void main()
{
float s,f0,h,x;
int n,i;
printf("input n:");
scanf("%d",&n);
h=1.0/n;
f0=4.0;
s=0.0;
for(i=1;i



Write a program in C language, input the coefficients a, B, C of quadratic equation of one variable, and calculate the roots of the equation (assuming two real roots, the test data must ensure this)
Urgent,


Hope to be useful, please accept^_^
# include
# include
int main()
{
Void root2 (double a, double B, double disc); / / define the function when the equation has two roots
Void root1 (double a, double B); / / define the function when the equation has only one root
Void root0(); / / defines a function that has no real solution to the equation
double a,b,c,disc;
Printf ("please enter the value of a, B, c)";
scanf("%lf %lf %lf",&a,&b,&c);
If (a = = 0) / / the coefficient of quadratic term of quadratic equation of one variable is not 0
{
printf("data error\n");
}
else
{
disc=b*b-4*a*c;
if(disc>0)
root2(a,b,disc);
else if(disc==0)
root1(a,b);
else
root0();
}
return 0;
}
void root2(double a,double b,double disc)
{
double x1,x2;
x1=(-b+sqrt(disc))/(2*a);
x2=(-b-sqrt(disc))/(2*a);
printf("x1=%lf\nx2=%f\n",x1,x2);
}
void root1(double a,double b)
{
double x;
x=(-b)/(2*a);
printf("x1=x2=%lf\n",x);
}
void root0()
{
Printf ("there is no real solution to the equation;";
}



C programming language input three parameters (real number) of quadratic equation of one variable from keyboard, calculate and output the two roots of the equation


I just learned C, and it took me several hours to solve this problem!
Has been run, the results with the same version of Tan, please rest assured to use
#include "stdio.h"
#include "math.h"
void main()
{ double a,b,c,x1,x2,disc,p,q;
printf("please input a,b,c:\n");
scanf("%lf,%lf,%lf",&a,&b,&c);
if (fabs(a)