Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C++

A simple program to solve quadratic equations with

1.50/5 (4 votes)
7 Nov 2010CPOL 10K  
#include<stdio...
C++
#include<stdio.h>
#include<conio.h>
void main()
{
   float a,b,c,x1,x2;
   clrscr();
   printf("Enter a=");
   scanf("%f",&a);
   printf("Enter b=");
   scanf("%f",&b);
   printf("Enter b=");
   scanf("%f",&b);
   x1=(-(b)+(sqrt((b^2)-(4*a*c))))/(2*a)
   x2=(-(b)-(sqrt((b^2)-(4*a*c))))/(2*a)
   printf("x=%f",x1);
   printf("\n or \n x=%f",x2);
   getch();
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)