Thursday, May 1, 2008

Write a shell script to print odd numbers upto ‘n’.

echo “Enter Upper limit”

read n

$i=1

while [$i -lt $n]

do

echo $i

expr ‘$i=$i+2’

done

5 comments:

Anonymous said...

not working :(

Anonymous said...

Echo $1
i=1
While [ $i -lt $1 ]
Do
Echo $i
i =`express $i + 2`
Done

This will work

Anonymous said...

Echo $1
i=1
While [ $i -lt $1 ]
Do
Echo $i
i =`express $i + 2`
Done

This will work

Unknown said...

Not working

Unknown said...

Not working