Find us on Facebook

Thursday, December 13, 2018

Check if the number is odd or even



 Aim: Implement a program to check if the number is odd or even.
Algorithm:
1.Start
2.If (n%2=0) then 
3.Print number is even 
4.else 
5.Print number is odd
6.Stop

Program:
# Python program to check if the input number is odd or even.
# A number is even if division by 2 give a remainder of 0.
# If remainder is 1, it is odd number.
num = int(input("Enter a number: "))
if (num % 2) == 0:
   print “Even"
 else:
   print “Odd”
 Output :
Enter a number: 43
 Odd

0 Comments:

Popular Posts

Text Widget

Search This Blog

Powered by Blogger.

Blogger Pages

Like Canvas?

Sponsor

Footer Widgetized Areas

About Canvas

About Canvas

Subscribe Us

About

Text Widget

Tags

Total Pageviews

print pdf

cal

Most Popular

    TUPLES
 LIST and SLICING
      ASCII VALUE
Copyright © KTU Btech Cse Python Lab Manuals | Powered by Blogger
Design by Saeed Salam | Blogger Theme by NewBloggerThemes.com | Distributed By Gooyaabi Templates