echo “Upper limit”
read n
$i = 1
while [$i -lt $n]
do
echo $i
expr ‘$i=$i+1’
Thursday, May 1, 2008
Write a shell script to print natural numbers up to ‘n’ using while loop.
Subscribe to:
Post Comments (Atom)
echo “Upper limit”
read n
$i = 1
while [$i -lt $n]
do
echo $i
expr ‘$i=$i+1’
3 comments:
your code has errors
this is the correct one
echo "enter value of n"
read n
echo "natural numbers:"
i=1
while [ $i -le $n ]
do
echo $i
i=`expr $i + 1`
done
Kya re bhen k laude output nhi arha
Your code also have errors
Post a Comment