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
shell script for reverse the string
Determine the output of the following command: [ -z “” ] && echo 0 || echo 1
What is basename in shell script?
What is bash coding?
What is k shell?
What are the four fundamental components of every file system on linux?
What is a program shell?
Why is it called a shell?
What are types of shells?
What is the equivalent of a file shortcut that we have a window on a linux system?
How to write a function?
What is path variable bash?
What is the purpose of scripting?
What are the 3 standard streams in linux?
What are the default permissions of a file when it is created?