write a python program to print the series 1 3 5 7 9 11 up to a given limit
Answers
Answered by
22
Answer:
limit=int(input("How much do you want to print "))
for i in range(1,limit+1,2):
print(i)
==>>See image
Attachments:
Answered by
11
Below are the program for the above question :
Explanation:
Program :
Limit_Size=int(input("enter the limit to print the series")) # It is used take the input from the user.
i=1 # It is used to take the intial value for while loop.
while(i<=Limit_Size): # while loop
print(i, end=" ") # It is used to print the series.
i=i+2 # It is used to increase the value.
Output:
- If the user gives 11 as the input then it will prints 1 3 5 7 9 11.
- If the user gives 5 as input then it will prints 1 3 5.
Code Explanation:
- The above code render a message to the user and take input from the user and store it on the Limit_Size variable after covering it into integer value.
- Then the while loop prints the series which starts from 1 and ends in the value of the Limits_size.
Learn More:
- Python program : https://brainly.in/question/5558161
Similar questions