Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


program to find the roots of a quardratic equation



program to find the roots of a quardratic equation..

Answer / valli

/***********
quadratic equationis ax^2+bx+c=0
************8/
#include<math.h>
main()
{
int a,b,c,d,r1,r2;
printf("enter the values of a,b,c");
scanf("%d%d%d",&a,&b,&c)'
d=(b*b)-(4*a*c);
if(d<0)
{
printf("the roots are imaginary");
d=sqrt(-d);
printf("\nroots are %d+i%d",-b/(2*a),d/(2*a));
printf("\n%d-i%d",-b/(2*a),d/(2*a));
}
else
{
d=sqrt(d);
r1=(-b+d)/(2*a);
r2=(-b-d)/(2*a);
printf("the roots of the equation are %d %d ",r1,r2);
}
}

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More C Interview Questions

Why do we need a structure?

0 Answers  


what is the difference between i++ and ++i?

5 Answers  


Write a program for deleting duplicate elements in an array

3 Answers   Subex,


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

0 Answers  


what is the difference between postfix and prefix unary increment operators?

3 Answers  


What is the Difference between Class and Struct?

10 Answers   Motorola,


Q. where is the below variables stored ? - volatile, static, register

3 Answers   Bosch,


Is this program statement valid? INT = 10.50;

0 Answers  


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

0 Answers  


Why preprocessor should come before source code?

2 Answers  


Who had beaten up hooligan "CHAKULI" in his early college days?

1 Answers  


what is the difference between declaration ,defenetion and initialization of a variable?

7 Answers   LG Soft,


Categories