write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0
Answer Posted / rupesh
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, c;
float x1, x2, root, d;
clrscr();
printf("Enter the values of a, b & c");
scanf("%d %d %d", &a, &b, &c);
if(a==0 && b==0)
printf("There izz no Soln...");
else
if(a=0)
{
root= -c/b;
printf("root = %d", root);
}
else
d = b*b-4*a*c;
if(d>=0)
{
x1 = (-b + d)/2*a;
x2 = (-b - d)/2*a;
printf("Roots are....x1 = %f, x2 = %f\n", x1,x2);
}
else
printf("Given Eqn has imaginary roots");
getch();
}
| Is This Answer Correct ? | 32 Yes | 41 No |
Post New Answer View All Answers
What are inbuilt functions in c?
I have seen function declarations that look like this
Write the control statements in C language
What is the importance of c in your views?
What is the size of a union variable?
In c language can we compile a program without main() function?
Where are local variables stored in c?
What is the difference between malloc calloc and realloc in c?
What are the 3 types of structures?
Write a program to check armstrong number in c?
What is the collection of communication lines and routers called?
When would you use a pointer to a function?
Mention four important string handling functions in c languages .
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.