write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0
Answer Posted / abc
#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 ? | 8 Yes | 11 No |
Post New Answer View All Answers
What is the difference between āgā and āgā in C?
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
What is omp_num_threads?
In a switch statement, what will happen if a break statement is omitted?
Why structure is used in c?
What is the g value paradox?
What is null in c?
Which type of language is c?
Difference between constant pointer and pointer to a constant.
Is a pointer a kind of array?
What is structure packing in c?
Can a void pointer point to a function?
Is null always defined as 0(zero)?
what are enumerations in C
What is #include stdlib h?