A simple program to solve quadratic equations with [Tip/Trick]
Posted: 10 Jun 2010
Updated: 8 Nov 2010
Rating: 4.00/5
Votes: 7
Popularity: 3.38
Licence: The Code Project Open License (CPOL)
Bookmarked: 3
Downloaded: 0
Simple and prints imaginary roots too!float a,b,c,x1,x2,d,dsq;printf("ax^2 + bx + c = 0");printf("\nEnter a,b,c separated by commas : \n");scanf("%f,%f,%f",&a,&b,&c);d = b*b-(4*a*c);if(d>=0){dsq=sqrt(d);x1 = (-b+dsq)/(2*a);x2 = (-b-(dsq))/(2*a);printf("\nRoot 1 : %f\nRoot 2...