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
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
What is typeof in c?
How is a pointer variable declared?
How can I manipulate strings of multibyte characters?
Is c still used?
What is #define in c?
Why is it usually a bad idea to use gets()? Suggest a workaround.
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?
What does malloc () calloc () realloc () free () do?
Write a progarm to find the length of string using switch case?
Can you please compare array with pointer?
What is structure and union in c?
What are the different file extensions involved when programming in C?
Write a code to determine the total number of stops an elevator would take to serve N number of people.
why programs in c are running with out #include