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 / patel mac p

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int a,b,c,d;
float x1,x2,root;
printf("\nEnter the value of a,b,c");
scanf("%d %d %d",&a,&b,&c);
d=(b*b)-(4*a*c);
if(a==0&&b==0)
{
printf("\nNO SOLUTION");
}
else
if(a==0&&b!=0)
{
root=-c/b;
printf("ROOT=%f",root);
}
else
if(d>=0)
{
printf("\nROOTS ARE REAL");
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
printf("\nX1=%f",x1);
printf("\nx2=%f",x2);
}
else
if(d<0)
{
printf("\nTHIS EQUATION HAS IMAGINARY ROOTS");
}
getch();
}

Is This Answer Correct ?    11 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

1233


what is uses of .net

1734


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1721


What is self-referential structure in c programming?

1215


What does %d do in c?

960


Why void is used in c?

1017


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

2352


p*=(++q)++*--p when p=q=1 while(q<=6)

1758


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

1047


What is array of pointers to string?

1069


Explain the difference between #include "..." And #include <...> In c?

1026


Can you subtract pointers from each other? Why would you?

961


What do you mean by a sequential access file?

1079


Is r written in c?

1152


What is a MAC Address?

1057