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


Please Help Members By Posting Answers For Below Questions

Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3127


what is the structure pointer?

1644


What is data structure in c programming?

574


Can a pointer be null?

565


What is wrong in this statement?

606






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.

1381


Differentiate between null and void pointers.

633


What is #include in c?

600


i want to know the procedure of qualcomm for getting a job through offcampus

1940


How a string is stored in c?

589


What is abstract data structure in c?

531


What is the use of ?: Operator?

669


a c code by using memory allocation for add ,multiply of sprase matrixes

2304


Do you know what are bitwise shift operators in c programming?

587


Explain how can you tell whether a program was compiled using c versus c++?

578