write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0
Answer Posted / shravya poojitha
#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 ? | 142 Yes | 49 No |
Post New Answer View All Answers
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
In which header file is the null macro defined?
When should I declare a function?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
What are the types of arrays in c?
Subtract Two Number Without Using Subtraction Operator
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
What math functions are available for integers? For floating point?
what is the structure pointer?
What is int main () in c?
Write a program to check prime number in c programming?
Who invented b language?
write an algorithm to display a square matrix.
What is the difference between memcpy and memmove?