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

// using sqrt in the program it needs header file <math.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,delta,alpha,beta;
clrscr();

printf("\nENTER THE VALUE OF a:");
scanf("%f",&a);
printf("\nENTER THE VALUE OF b:");
scanf("%f",&b);
printf("\nENTER THE VALUE OF c:");
scanf("%f",&c);

delta=(b*b)-(4*a*c);

if(delta>0)
{
alpha=(-b-sqrt(delta))/(2.0*a);
beta=(-b+sqrt(delta))/(2.0*a);
printf("\nalpha=%f",alpha);
printf("\nbeta=%f",beta);

}
else if(delta==0)
{
printf("\nROOTS ARE REAL");
alpha=-b/(2.0*a);
beta=-b/(2.0*a);
printf("\nalpha=%f",alpha);
printf("\nbeta=%f",beta);
}
else
{
printf("\nROOTS ARE IMAGINARY");
}
getch();
}

Is This Answer Correct ?    23 Yes 25 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

2310


How do you define CONSTANT in C?

1370


main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above

1159


How variables are declared in c?

1108


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

1772


What is pointers in c with example?

1140


What does struct node * mean?

1071


How pointer is different from array?

1149


What is the use of volatile?

1153


How can I write a function that takes a format string and a variable number of arguments?

1105


write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list

2869


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

1487


What is %d called in c?

1284


Are there any problems with performing mathematical operations on different variable types?

1106


What are global variables and how do you declare them?

1176