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
Can shell script run on windows?
How do we create command aliases in a shell?
How to find all the files modified in less than 3 days and save the record in a text file?
Determine the output of the following command: [ -z “” ] && echo 0 || echo 1
wats the deinitions for shell utility and filter?
c program to implement unix/linux command to block the signal ctrl-c and ctrl-\ signal during the execution ls -l|wc -l
How to print all the arguments provided to the script?
What is the first line in every perl script called?
What is echo $shell?
What is shell chemistry?
I have 2 files and I want to print the records which are common to both.
What is the crontab?
How do I stop script errors?
What is bash eval?
I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?