**Program:**

**echo enter n value as range to calculate odd and even numbers.**

**read n**

**i=1**

**while [ $i -le $n ]**

**do**

**if [ `expr $i % 2` -eq 0 ]**

**then**

**echo even=$i**

**else**

**echo odd=$i**

**fi**

**i=`expr $i + 1`**

**done**

# Input/OutPut

**echo enter n value as range to calculate odd and even numbers.**

10

odd=1

even=2

odd=3

even=4

odd=5

even=6

odd=7

even=8

odd=9

even=10

what if we put any negative values or zero????

ReplyDelete