Even or Odd check it Now coderinme

Even or Odd check it Now coderinme

Even or Odd check it Now coderinme
Given any number, when it is divided 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

#!/usr/bin/env python
no=int(raw_input("Enter the no.: "))
if no % 2 == 0 :
print no,' is Even.'
else:
print no,' is Odd.'

For more programs on Python, visit our Python Coder Archives

Even or Odd check it Now coderinme

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.