Sunday, 8 August 2021

Odd numbers between 1 to 10 using while loop

Following Python program will print odd numbers between 1 to 10 using while loop. 

Expected Output: 1 3 5 7 9 


Program Code:

number = 1

while number <= 10:
  print(number, end=" ")
  number = number + 2

Output of Program:

1 3 5 7 9


* * * * *


< Back to Python Loops >

< Back to Home >



No comments:

Post a Comment