write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0
Answer Posted / theara
#include<stdio.h>
#include<conio.h>
void main()
{
float a, b, c;
float x1, x2, root, d;
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 ? | 14 Yes | 16 No |
Post New Answer View All Answers
What is the explanation for the dangling pointer in c?
Write a program to print factorial of given number without using recursion?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
What are keywords c?
How can I read in an object file and jump to locations in it?
Write a code to generate divisors of an integer?
What is default value of global variable in c?
what is the difference between class and unio?
What is auto keyword in c?
What is a 'null pointer assignment' error?
Why we use int main and void main?
What are the types of c language?
How can I manipulate strings of multibyte characters?
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.