Thursday, May 1, 2008

Write a shell script to find the sum of the odd numbers upto ‘n’.

echo “Enter Upper limit”

read n

$i=1

while [Si -lt $n]

do

expr ‘$sum=$sum+$i’

expr ‘$i=$i+2’

done

echo “sum is : $sum”

No comments: