#include <stdio.h> #include <math.h> int main() { float a, b, c, determinant, r1,r2, real, imag; printf("Enter coefficients a, b and c: "); scanf("%f%f%f",&a,&b,&c); determinant=b*b-4*a*c; if (determinant>0) { r1= (-b+sqrt(determinant))/(2*a); r2= (-b-sqrt(determinant))/(2*a); printf("Roots are: %.2f and %.2f",r1 , r2); } else if (determinant==0) { r1 = r2 = -b/(2*a); printf("Roots are: %.2f and %.2f", r1, r2); } else { real= -b/(2*a); imag = sqrt(-determinant)/(2*a); printf("Roots are: %.2f+%.2fi and %.2f-%.2fi", real, imag, real, imag); } return 0; }
Most Popular
-
Befunge: Developed by : Chris Pressey Year: 1993 ...
-
-
The list below is an unordered list. You can pick any...
-
Recursion happens when function calls itself directly...
Copyrights © 2016 Codzya. Powered by Blogger.
Monday, May 16, 2016
Subscribe to:
Post Comments (Atom)
- Recent
- Weekly
- Comment
Recent
As a task executes it utilizes the processor...
Sep 25 2016 | Read moreMemory leak occurs when programmers create a memory in heap and...
Aug 19 2016 | Read moreBefunge: Developed by : Chris Pressey Year: 1993 Stack-based,...
May 19 2016 | Read more1- The C Programming Language This book is a comprehensive...
May 18 2016 | Read more1. Java The tech community recently celebrated the 20th...
May 17 2016 | Read more
Weekly
-
Befunge: Developed by : Chris Pressey Year: 1993 ...
-
-
The list below is an unordered list. You can pick any...
-
Recursion happens when function calls itself directly...
-
1- The C Programming Language This book is a...
Comment
Get this Recent Comments Widget
0 Comment to "Find Roots Of Quadratic Equation."
Post a Comment