Computer Science, asked by krishkishore2224, 7 months ago

Write a python program to find whether the given number odd or even if the number is even check whether it is divisible by 5

Answers

Answered by LastShinobi
1

Answer:

\small\green{\star Verified Answer}

\huge\star\underbrace{\mathtt\red{⫷ᴀ᭄} \mathtt\green{n~ }\mathtt\blue{ §} \mathtt\purple{₩}\mathtt\orange{Σ} \mathtt\pink{R⫸}}\star\:

# Python program to check if the input number is odd or even.

# A number is even if division by 2 gives a remainder of 0.

# If the remainder is 1, it is an odd number.

num = int(input("Enter a number: "))

if (num % 2) == 0:

print("{0} is Even".format(num))

else:

print("{0} is Odd".format(num))

Explanation:

¯\_(ツ)_/¯

Answered by harshdeepsingh2182
0

Answer:

: Find whether a given number is even or odd, print out an appropriate message to the usera

Last update on September 01 2020 10:27:36 (UTC/GMT +8 hours)

Python Basic: Exercise-21 with Solution

Write a Python program to find whether a given number (accept from the user) is even or odd, print out an appropriate message to the user.

Pictorial Presentation of Even Numbers:

Even Numbers

Pictorial Presentation of Odd Numbers:

Odd Numbers

Sample Solution:-

Python Code:

num = int(input("Enter a number: "))

mod = num % 2

if mod > 0:

print("This is an odd number.")

else:

print("This is an even number.")

Copy

Sample Output:

Enter a number: 5

This is an odd number.

Even Numbers between 1 to 100:

Even Numbers between 1 to 100

Odd Numbers between 1 to 100:

Odd Numbers between 1 to 100

Flowchart:

Flowchart: Find whether a given number is even or odd, print out an appropriate message to the user.

Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to get a string which is n (non-negative integer) copies of a given string.

Next: Write a Python program to count the number 4 in a given list.

Similar questions