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 the difference between class and unio?
Differentiate fundamental data types and derived data types in C.
Explain what is a 'locale'?
write a program for the normal snake games find in most of the mobiles.
Why c is called top down?
What is the 'named constructor idiom'?
When should you use a type cast?
Explain how can I open a file so that other programs can update it at the same time?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
in iso what are the common technological language?
Write a program that accept anumber in words
What is pivot in c?
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.
What 'lex' does?