65.9K
CodeProject is changing. Read more.
Home

A simple program to solve quadratic equations with

starIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIconemptyStarIcon

1.50/5 (4 votes)

Oct 26, 2010

CPOL
viewsIcon

9950

#include<stdio...

#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();
}