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

Answer Posted / padmas

echo -n "Please give any odd number : "
read n

rem=$(( $n % 2 ))

if [ $rem -eq 0 ]
then
echo "Thank you for giving even number."
else
echo "Yes, it is odd"
fi

Is This Answer Correct ?    9 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to debug the problems encountered in the shell script/program?

632


What is an sh file?

560


Explain about login shell?

636


Determine the output of the following command: name=shubham && echo ‘my name is $name’.

535


Explain how you Automate your application using Shell scripting.

1852






What is web script?

586


I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?

754


Which is better perl or shell scripting?

561


What are scripts in psychology?

601


What is shell variable?

532


Explain about echo command?

625


how will you find the total disk space used by a specific user?

584


What is basename in shell script?

591


How to print pid of the current shell?

604


Is powershell a bash?

590