/*------------------------------------------------------------------------------------------------
Program : Write a program in c to compute the roots
of a quadratic Equation.
Created
By: JABIR DAUD PATHAN
Branch : COMPUTER ENGINEERING
-------------------------------------------------------------------------------------------------*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
void
main()
{
int a,b,c,x1,x2;
clrscr();
printf("Enter any values of a,b and
c==>\n");
scanf("%d%d%d",&a,&b,&c);
x1=((-b)+sqrt((b*b)-(4*a*c)))/(2*a);
x2=((-b)-sqrt((b*b)-(4*a*c)))/(2*a);
printf("\nRoots of Quadratic
equation==>\n\t x1=%d\tx2=%d",x1,x2);
getch();
}
/*-----------------<< OUTPUT SCREEN >>-------------------*/
Enter
any values of a,b and c==>
1
-5
6
Roots
of Quadratic equation==>
x1=3
x2=2
No comments:
Post a Comment