Write a shell program to test whether a given number is even
or odd?

Answer Posted / karishma

echo -n "Enter numnber : "
set number = $<

set rem=expr( $number % 2 )

if($rem -eq 0)
then
echo "$number is even number"
else
echo "$number is odd number"
endif

Is This Answer Correct ?    19 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c in shell script?

642


How to write a function?

597


What is web script?

586


What is echo $shell?

628


Explain about the slow execution speed of shells?

779






What is awk in shell scripting?

559


What are the different commands available to check the disk usage?

497


How can I send a mail with a compressed file as an attachment?

558


What does sh mean?

622


How to get the first line from a file using just the terminal?

599


What is the first line in every perl script called?

559


What is the difference between scripting and coding?

541


Write the syntax for "if" conditionals in linux?

599


What is the difference between grep and egrep?

615


How to print all array elements and their respective indexes?

512