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
How do we make a global variable accessible across files? Explain the extern keyword?
What is "Duff's Device"?
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
How can you read a directory in a C program?
What is meant by keywords in c?
What are the advantages of using new operator as compared to the function malloc ()?
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
Why shouldn’t I start variable names with underscores?
Write a program to print numbers from 1 to 100 without using loop in c?
What is wrong with this statement? Myname = 'robin';
How many types of errors are there in c language? Explain
What is the difference between array and pointer in c?
What is malloc calloc and realloc in c?
What is the difference between scanf and fscanf?
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.