Click here to Skip to main content
Click here to Skip to main content

A simple program to solve quadratic equations with

float a,b,c,x1,x2,d;printf("ax^2 + bx + c = 0");printf("\nEnter a,b,c separated by commas : \n");scanf("%f,%f,%f",&a,&b,&c);d = pow(b,2)-(4*a*c);if(d>=0){x1 = (-b+sqrt(d))/(2*a);x2 = (-b-(sqrt(d)))/(2*a);printf("\nRoot 1 : %f\nRoot 2 : %f",x1,x2);}if(d<0){d =...
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 | Mobile
Web04 | 2.8.140709.1 | Last Updated 10 Jun 2010
Article Copyright 2010 by Anshul R
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid