Program to Print Odd Numbers Within a Given Range | Python Tutorial | Yes I Can Do

Опубликовано: 16 Июнь 2021
на канале: Yes I Can Do
2,422
24

#Printoddnumber #printnumber #pythonevenodd #Yes_I_Can_Do
----------------------------------------------------------------------------------------------------------------------------------------
Python Program to print odd numbers within a given range. The program output is also shown below.

Program Explanation
1. User must enter the upper range limit and the lower range limit.
2. The for loop ranges from the lower range limit to the upper range limit.
3. The expression within the if-statement checks if the remainder obtained when the number divided by 2 is one or not (using the % operator).
4. If the remainder isn’t equal to 0, the number is odd and hence the number is printed.

Runtime Test Cases

Case 1:
Enter the lower limit for the range:1
Enter the upper limit for the range:16
1
3
5
7
9
11
13
15

Case 2:
Enter the lower limit for the range:150
Enter the upper limit for the range:180
151
153
155
157
159
161
163
165
167
169
171
173
175
177
179
----------------------------------------------------------------------------------------------------------------------------------------
#printnumbergivenrange
#pythonlearning #pythoncode #python3 #coder #learntocode #Tutorial


На этой странице сайта вы можете посмотреть видео онлайн Program to Print Odd Numbers Within a Given Range | Python Tutorial | Yes I Can Do длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Yes I Can Do 16 Июнь 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 2,422 раз и оно понравилось 24 зрителям. Приятного просмотра!