Roots of a quadratic equation in C Language
Write a Roots of a quadratic equation program in C to compute the roots of a quadratic equation.Consumer has to supply values of variables of equation initially.
Then program will discover the worth of Roots of a quadratic equation .
Roots of a quadratic equation Code
1 |
#embody<stdio.h><br/>#embody<conio.h><br/>#embody<math.h><br/><br/>void foremost()<br/>{<br/>float a,b,c,root1,root2;<br/>clrscr();<br/>printf(“n Enter values of a,b,c for locating roots of a quadratic eq:n”);<br/>scanf(“%fpercentfpercentf”,&a,&b,&c);<br/><br/>if(b*b>4*a*c)<br/>{<br/>root1=-b+sqrt(b*b-4*a*c)/2*a;<br/>root2=-b-sqrt(b*b-4*a*c)/2*a;<br/>printf(“n*****ROOTS ARE*****n”);<br/>printf(“n root1=%fn root2=%f”,root1,root2);<br/>}<br/>else<br/>printf(“n Imaginary Roots.”);<br/>getch();<br/>} |
Supply projectgeek.com