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

hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..

1467


Array is an lvalue or not?

640


What is the difference between test design and test case design?

1570


Write the test cases for checking a variable having value in range -10.0 to +10.0?

1816


What is data type long in c?

623






Explain how can I pad a string to a known length?

654


Why is c so popular?

650


What is the benefit of using const for declaring constants?

588


What is calloc malloc realloc in c?

594


I have a varargs function which accepts a float parameter?

579


What is the difference between typedef and #define?

545


Write a program to generate the Fibinocci Series

664


What is the argument of a function in c?

574


string reverse using recursion

1812


What is const and volatile in c?

566