Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Mathematics ProgramRSS Feeds

Program to fine solution of QUADRATIC EQUATION

Posted By: Isabella Campbell     Category: C Programming     Views: 9217

Write a program to fine solution of QUADRATIC EQUATION

Code for Program to fine solution of QUADRATIC EQUATION in C Programming

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
   float a,b,c,disc,root1,root2;
  clrscr();
   printf("Input values of a,b,and c\n");
   scanf("%f %f %f", &a,&b,&c);

   disc = b*b - 4*a*c;

   if(disc<0)
      printf("\n\n ROOTS ARE IMAGINARY\n");
   else
   {
      root1 = (-b + sqrt(disc))/(2.0*a);
      root2 = (-b - sqrt(disc))/(2.0*a);
      printf("\n\nroot1 = %5.2f\n\nroot2 = %5.2f\n",root1,root2);
    }

getch();
}
  
Share: 


Didn't find what you were looking for? Find more on Program to fine solution of QUADRATIC EQUATION Or get search suggestion and latest updates.

Isabella Campbell
Isabella Campbell author of Program to fine solution of QUADRATIC EQUATION is from Toronto, Canada.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!