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
What is awk in shell script?
What is the first line in every perl script called?
What are the different variables present in linux shell?
What are the different types of variables used in shell script?
What is the significance of the shebang line in shell scripting?
How can the contents of a file inside jar be read without extracting in a shell script?
is this growing field and what is average package in this?
Where is bash history?
What is $1 in shell scripting?
What is an sh file?
How can I set the default rwx permission to all users on every file which is created in the current shell?
How to set an array in linux?
What are scripts in psychology?
I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?
Write down the syntax of "for " loop