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 / rupesh

#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, c;
float x1, x2, root, d;
clrscr();
printf("Enter the values of a, b & c");
scanf("%d %d %d", &a, &b, &c);
if(a==0 && b==0)
printf("There izz no Soln...");
else
if(a=0)
{
root= -c/b;
printf("root = %d", root);
}
else
d = b*b-4*a*c;
if(d>=0)
{
x1 = (-b + d)/2*a;
x2 = (-b - d)/2*a;
printf("Roots are....x1 = %f, x2 = %f\n", x1,x2);
}
else
printf("Given Eqn has imaginary roots");
getch();
}

Is This Answer Correct ?    32 Yes 41 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset

1104


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

8045


Are pointers integer?

1014


Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.

2234


Explain the advantages of using macro in c language?

999


Explain about the constants which help in debugging?

1379


What is the heap?

1218


What is identifier in c?

1012


Explain what is the benefit of using enum to declare a constant?

1078


What is wrong with this initialization?

1007


Explain the concept and use of type void.

1113


Explain what are preprocessor directives?

1067


What are the standard predefined macros?

1144


What is a nested loop?

1128


Explain how can I convert a string to a number?

1099