computing-fundamentals
C programs and question bank.
Wednesday, October 27, 2010
Quadratic equation
void main
(
)
{
float
a,b,c,d,s,x,y;
printf
(
"Enetr the values of a,b,c"
)
;
scanf
(
"%f %f %f"
,&a,&b,&c
)
;
d=
(
(
b*b
)
-
(
4
*a*c
)
)
;
s=sqrt
(
d
)
;
x=
(
-b+s
)
/
(
2
*a
)
;
y=
(
-b-s
)
/
(
2
*a
)
;
printf
(
"The quadratic equation is x=%f and y=%f"
,x,y
)
;
getch
(
)
;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment