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...

write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0

Answer Posted / rohit

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,root;
float x1,x2;
printf("enter the roots a,b,c");
scanf("%d %d %d",&a,&b,&c);
if(a=0&&b=0)
printf("no solution");
else
if(a=0)
{
root=-c/b;
printf("root=%d",root);
}
else
if[(b*b-4*a*c)>0]
{
x1=[-b+sqrt (b*b-4*a*c)]/(2*a);
x2=[-b-sqrt (b*b-4*a*c)]/(2*a);
printf("the roots are x1=%f,x2=%f",x1,x2);
}
else
printf("it has imaginary roots");
getch();
}

Is This Answer Correct ?    29 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a macro?

1115


Why does everyone say not to use gets?

1109


What is far pointer in c?

1317


How do you initialize pointer variables?

1107


what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above

1128


What is keyword with example?

1070


What would be an example of a structure analogous to structure c?

1001


what is the role you expect in software industry?

2154


Explain do array subscripts always start with zero?

1241


What are header files and explain what are its uses in c programming?

1135


What is the meaning of && in c?

1024


what is reason of your company position's in india no. 1.

2341


Explain data types & how many data types supported by c?

1085


Explain how can a program be made to print the name of a source file where an error occurs?

1198


In C, What is the #line used for?

2214