Algorithm:

1. Start the program.

2. Enter the number to check even or odd,

3. Get the remainder by dividing the number by 2 (use % operator).

4. Check if remainder is zero then given number is even otherwise given number . 5. Stop the program

Program:

#ODD-EVEN checking program

echo “Enter a number”

read a

z=’expr$a%2’

if test $z —eq 0

then

echo “Even number”

else

echo “Odd number”

fi

Output:

Enter the number

22

Even Number.

## Wednesday, October 27, 2010

New

# SIMPLE SHELL PROGRAMS EX No 4 CHECKING OF EVEN OR ODD NUMBER

**About Rejin Paul**

A Blogger at programforu.com , helping students to find programs for their career Development

UNIX LAB MANUAL

Labels:
UNIX LAB MANUAL

Subscribe to:
Post Comments (Atom)

## No comments:

## Post a Comment