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


Please Help Members By Posting Answers For Below Questions

write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34

1628


What is typeof in c?

609


How is a pointer variable declared?

594


How can I manipulate strings of multibyte characters?

639


Is c still used?

604






What is #define in c?

622


Why is it usually a bad idea to use gets()? Suggest a workaround.

904


Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?

1600


What does malloc () calloc () realloc () free () do?

560


Write a progarm to find the length of string using switch case?

1612


Can you please compare array with pointer?

617


What is structure and union in c?

601


What are the different file extensions involved when programming in C?

758


Write a code to determine the total number of stops an elevator would take to serve N number of people.

728


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1317