Logo 
Search:

C Programming Articles

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

Program to obtain roots of a quadratic equation

Posted By: Voliny Fischer     Category: C Programming     Views: 5900

Write a program to obtain roots of a quadratic equation.

Code for Program to obtain roots of a quadratic equation in C Programming

#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float  a, b, c;
float root1, root2,de,d;
printf("enter the values of a, b and c");
scanf("%f%f%f", &a,&b,&c);
de=(b*b)-4*(a*c);
d=sqrt(de);
root1=(-b+d) /(2.0*a);
root2=(-b-d) /(2.0*a);
printf(" roots of the equation are %f %f", root1,root2);
getch();
}
  
Share: 


Didn't find what you were looking for? Find more on Program to obtain roots of a quadratic equation Or get search suggestion and latest updates.

Voliny Fischer
Voliny Fischer author of Program to obtain roots of a quadratic equation is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
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!