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

write a program to concatenation the string using switch case?

1554


what are non standard function in c

1431


Explain About fork()?

643


Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.

1588


What do you mean by command line argument?

638






How many data structures are there in c?

612


What is a const pointer?

630


How can I insert or delete a line (or record) in the middle of a file?

570


What is multidimensional arrays

624


What is a protocol in c?

552


How can you tell whether a program was compiled using c versus c++?

618


What is the difference between mpi and openmp?

731


What is d'n in c?

630


What is extern variable in c with example?

536


What is conio h in c?

622