Write a Python program to print every integer between 1 and n divisible by m. Also report whether the number that is divisible by m is even or odd.
Answers
Answer:
Write a Python program to print every integer between 1 and n divisible by m. Also report whether the number that is divisible by m is even or odd. Previous Post 14. Given a list of integers, write a program to find those which are palindromes.
Explanation:
· Here is the source code of the Python Program to print all ... number to be divided by:")) for i in range(lower,upper+1): .
Answer:
n = int(input("Enter a last limit of number: "))
m = int(input("Enter a diviser: "))
for i in range (1, n):
if i%m == 0:
print(i, "is divisible by ", m)
if i%2 == 0:
print(i, " is even")
else :
print(i, " is odd")
Explanation:
they asked us to print from 1 integer to n
now for n, we need to get user input so we use
now they are also asking us to get input of m so use
after that, they ask us whether the number between 1 and n is even or odd and to check if its divisible or not
for example:
if n is which is the last limit of a number between 1 is 10
and m is 2
then the output will be like this
Enter the last limit of number: 10
Enter a divisor: 2
1 is odd
2 is divisible by 2
2 is even
3 is odd
4 is divisible by 2
4 is even
5 is odd
6 is divisible by 2
6 is even
7 is odd
8 is divisible by 2
8 is even
9 is odd
If u understood it then pls put 5 stars or 4 stars and like the answer :D