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

Which is better perl or shell scripting?

559


What is the conditional statement in shell scripting?

661


What is shell scripting?

593


Which shell is the best?

576


How do I save a powershell script?

560






What is batch file programming?

696


How will you emulate wc –l using awk?

913


What is the lifespan of a variable inside a shell script?

1125


How are shells born?

557


Explain about return code?

632


What is the difference between grep and egrep?

612


What is the best shell scripting language?

541


How to pass an argument to a script?

594


What is awk in shell script?

754


How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?

718