Your Only Destination To Empower Your Computer Programing Knowledge. Sky is not so high, You can Touch it if You Try

Script to show the use of while loop.

echo Enter a number to print it's table
read n
i=1
while [ $i -lt 10 ]
do
i='expr$i*$n'
i='expr$i+1'
echo $i
done


~
~
~
~
~
~
~
~
~
~
"while" 13L, 158C


Output:-

Even numbers between 1-20 are:-
2
4
6
8
10
12
14
16
18
20

No comments:

Post a Comment