Unix shell program to find the roots of a quadratic equation?

1 answer

Answer

1089797

2026-07-18 13:01

+ Follow

echo "Enter a value: "

read a

echo "Enter a value: "

read b

echo "Enter a value: "

read c

x1= echo "scale=7; (-$b+sqrt($b^2-4*$a*$c))/(2*$a)"|bc'

x2= echo "scale=7; (-$b-sqrt($b^2-4*$a*$c))/(2*$a)"|bc'

echo $x1

echo $x2

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.