Instructions:
Instructions
Input
A line containing an integer.
10
Output
Multiple lines containing an integer.
9
7
5
3
1
SOLUTION TO THE ABOVE QUESTION
SOLUTION CODE
my_integer_variable = int(input("\nEnter an integer greater than zero: "))
#define a function called input that will take the positive integer grate than 0
def input_function(integer_value):
my_variable = integer_value
while my_variable > 0:
if my_variable % 2 == 1:
print(my_variable)
my_variable = my_variable - 1;
#call the above defined function and give it our integer value
if my_integer_variable > 0:
input_function(my_integer_variable)
else:
print("The integer value is not greater than zero")
SAMPLE OUTPUT PROGRAM
Comments
Leave a comment