Home Roots of Quadratic Equation
mod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_counter
mod_vvisit_counterToday1
mod_vvisit_counterYesterday0
mod_vvisit_counterThis week1
mod_vvisit_counterLast week0
mod_vvisit_counterThis month1
mod_vvisit_counterLast month0
mod_vvisit_counterAll days4219

We have: 1 guests online
Your IP: : 38.107.179.231
 , 
Today: May 21, 2012

Tracker

visitors by country counter
flag counter

C Program To Find Roots From Quadratic Equation

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,x1,x2;
clrscr();
printf(“Enter a, b & c:\n”);
scanf(“%f%f%f”,&a,&b,&c);
if(b*b>4*a*c)
{
x1=(-b+sqrt(b*b-4*a*c))/(2*a);
x2=(-b-sqrt(b*b-4*a*c))/(2*a);
printf(“The roots are:\n%f\n%f”,x1,x2);
}
else
printf(“The roots are imaginary.”);
getch();
}

Sample Run 1:
Enter a, b & c:
10
20
30
The roots are imaginary.

Sample Run 2:
Enter a, b &c:
5
15
10
The roots are:
-1.000000
-2.000000