write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0
Answer Posted / lazy guyz
#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 ? | 1 Yes | 7 No |
Post New Answer View All Answers
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
what is the structure pointer?
What is data structure in c programming?
Can a pointer be null?
What is wrong in this statement?
In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.
Differentiate between null and void pointers.
What is #include in c?
i want to know the procedure of qualcomm for getting a job through offcampus
How a string is stored in c?
What is abstract data structure in c?
What is the use of ?: Operator?
a c code by using memory allocation for add ,multiply of sprase matrixes
Do you know what are bitwise shift operators in c programming?
Explain how can you tell whether a program was compiled using c versus c++?