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
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What are the 3 types of structures?
Explain what is dynamic data structure?
What are comments and how do you insert it in a C program?
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
What are void pointers in c?
Explain the difference between strcpy() and memcpy() function?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
Explain the use of bit fieild.
Why does everyone say not to use gets?
Explain how do you determine the length of a string value that was stored in a variable?
What are control structures? What are the different types?
What is the maximum no. of arguments that can be given in a command line in C.?
How to declare a variable?
You have given 2 array. You need to find whether they will
create the same BST or not.
For example:
Array1:10 5 20 15 30
Array2:10 20 15 30 5
Result: True
Array1:10 5 20 15 30
Array2:10 15 20 30 5
Result: False
One Approach is Pretty Clear by creating BST O(nlogn) then
checking two tree for identical O(N) overall O(nlogn) ..we
need there exist O(N) Time & O(1) Space also without extra
space .Algorithm ??
DevoCoder
guest
Posted 3 months ago #
#define true 1
#define false 0
int check(int a1[],int a2[],int n1,int n2)
{
int i;
//n1 size of array a1[] and n2 size of a2[]
if(n1!=n2) return false;
//n1 and n2 must be same
for(i=0;i