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 are formal parameters?

649


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

621


What is a pointer variable in c language?

639


What is c token?

599


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

1782






How are structure passing and returning implemented?

585


How can I use a preprocessorif expression to ?

592


p*=(++q)++*--p when p=q=1 while(q<=6)

1262


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

649


How to implement a packet in C

2387


What is the difference between c and python?

576


Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.

1561


What is structure and union in c?

592


Why is c so important?

590


What are keywords in c with examples?

598