Even or Odd check it Now coderinme

Even or Odd check it Now coderinme

Even or Odd check it Now coderinme
Any number when divides by 2, should give either a remainder 0 or 1. If the remainder is 0, then it is even, If remainder is 1 then it’s odd. In simpler words, An even number is an integer that is exactly divisible by 2. Example: 8, 34, 0. An odd number is an integer that is not exactly divisible by 2. Example: 1, 7, 11, 15
So, if a number is x and then rem(x/2)==0 or x%2==0 then it is even else odd
so let’s code It


#!/bin/bash
(bash copy)
read -p "Enter any number: " num
if (( num % 2 == 0 )); then
echo "Number is even"
else
echo "Number is odd"
fi 

for more details click shell coding problems

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator” to the admin @coderinme

Leave a reply:

Your email address will not be published.