Develop a flow chart and write a c program to find the roots
of a quadratic equation ax2+bx+c=0 using switch and break
statement.

Answer Posted / naveen kumar.gembali

#include<stdio.h>
#include<conio.h>
main()
{
float a,b,c,r1,r2,d;
printf("enter a,b,c values");
scanf("%f%f%f",&a,&b,&c);
d=b*b-4*a*c;
if(d>0)
{
printf("the roots are real and unequal");
r1=(-b-sqrtd)/2*a;
r2=(-b+sqrtd)/2*a;
printf("the roots are %f%f",r1,r2);
}
else
if(d=0)
{
printf("the roots are real and equal");
r1=-b/2*a;
r2=r1;
printf("the roots are %f%f",r1,r2);
}
elseif(d<0)
{
printf("the roots are imaginary");
}
getch();
}
@naveenkumar.gembali@

Is This Answer Correct ?    8 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between class and structure?

570


Explain about the functions strcat() and strcmp()?

597


Describe the header file and its usage in c programming?

616


What is void main ()?

608


What is static volatile in c?

572






hi, which software companys will take,if d candidate's % is jst 55%?

1660


how to write a c program to print list of fruits in alpabetical order?

1786


Why c is called top down?

626


What is the use of c language in real life?

527


what is the height of tree if leaf node is at level 3. please explain

1598


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1211


What are the advantages of union?

624


What is volatile variable in c?

655


What is #define?

573


how to count no of words,characters,lines in a paragraph.

3900