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 are enums in c?
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?
What happens if header file is included twice?
What is adt in c programming?
What is dynamic variable in c?
What do the functions atoi(), itoa() and gcvt() do?
Explain bit masking in c?
code for replace tabs with equivalent number of blanks
How do you list files in a directory?
Tell me what are bitwise shift operators?
Can you write the function prototype, definition and mention the other requirements.
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
What is the meaning of ?
What is the advantage of an array over individual variables?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above