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

Difference between MAC vs. IP Addressing

0 Answers  


what about "char *(*(*a[])())();"

3 Answers   Oracle,


define switch statement?

6 Answers   CTS,


What is && in c programming?

0 Answers  


Can I pass constant values to functions which accept structure arguments?

2 Answers  


What does 2n 4c mean?

0 Answers  


 write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare.  You will then tabulate this information in another file.

0 Answers  


What is structure padding & expalain wid example what is bit wise structure?

1 Answers  


Whether there can be main inside another main?If so how does it work?

14 Answers   Sail, Wipro,


plz answer..... a program that reads non-negative integer and computes and prints its factorial

2 Answers  


What are multibyte characters?

0 Answers  


What are global variables?

0 Answers  


Categories