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
Can one function call another?
How was c created?
Define recursion in c.
What is pointer to pointer in c language?
How can I find out how much free space is available on disk?
What is function what are the types of function?
Which of these functions is safer to use : fgets(), gets()? Why?
how can use subset in c program and give more example
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
Write a code to generate a series where the next element is the sum of last k terms.
How does #define work?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
Not all reserved words are written in lowercase. TRUE or FALSE?
What is sizeof return in c?
Write a program for Overriding.