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 formal parameters?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
What is a pointer variable in c language?
What is c token?
how to write a c program to print list of fruits in alpabetical order?
How are structure passing and returning implemented?
How can I use a preprocessorif expression to ?
p*=(++q)++*--p when p=q=1 while(q<=6)
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
How to implement a packet in C
What is the difference between c and python?
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.
What is structure and union in c?
Why is c so important?
What are keywords in c with examples?