Click here to Skip to main content
11,437,649 members (48,232 online)
Click here to Skip to main content

A simple program to solve quadratic equations with

, 8 Nov 2010 CPOL
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...
This is an old version of the currently published tip/trick.

This article is still being written and is not currently available for general viewing.

Please go to the Programming Tips Table of Contents to view the list of available articles in this section.
| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150506.1 | Last Updated 8 Nov 2010
Article Copyright 2010 by Anshul R
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid