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
What is difference between class and structure?
Explain about the functions strcat() and strcmp()?
Describe the header file and its usage in c programming?
What is void main ()?
What is static volatile in c?
hi, which software companys will take,if d candidate's % is jst 55%?
how to write a c program to print list of fruits in alpabetical order?
Why c is called top down?
What is the use of c language in real life?
what is the height of tree if leaf node is at level 3. please explain
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.
What are the advantages of union?
What is volatile variable in c?
What is #define?
how to count no of words,characters,lines in a paragraph.