Click here to Skip to main content
11,705,451 members (41,548 online)
Click here to Skip to main content

A simple program to solve quadratic equations with

, 10 Jun 2010 CPOL 21.7K 3
Simple and prints imaginary roots too!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 :...
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.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150819.1 | Last Updated 10 Jun 2010
Article Copyright 2010 by Anshul R
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid