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
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
Array is an lvalue or not?
What is the difference between test design and test case design?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
What is data type long in c?
Explain how can I pad a string to a known length?
Why is c so popular?
What is the benefit of using const for declaring constants?
What is calloc malloc realloc in c?
I have a varargs function which accepts a float parameter?
What is the difference between typedef and #define?
Write a program to generate the Fibinocci Series
What is the argument of a function in c?
string reverse using recursion
What is const and volatile in c?