Translate

Labels

Tuesday 15 January 2013

SHELL PROGRAM

QUADRATIC EQUATION

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


SUM OF CUBE OF INDIVIDUAL DIGITS OF A NUMBER

echo"Enter a number:"
read n
t=$n
s=0
while[ $n -gt 0 ]
do 
r='expr $n % 10'
s='expr $s +$r\*$r\*$r'
n='expr $n / 10'
done
echo"The sum of cube of individual digits of $t is $s"

No comments: