Write a Shell Script that define a function named check. A number will be passed to the function as an argument and the function will check whether the number is even or odd or zero

Code:

numCheck ()
{
Remainder=$((number%2))
If [ $Remainder -eq 0]
Echo “This Is Even Number”;
elif [ $rem -eq 1]
echo “This Is Odd Number”;
else
echo “Number Is Zero”
}
Echo “Enter Any Number: “
Read number;
numCheck $number

Post a Comment

0 Comments