Make changes in for loop and while loop program and create a Python program
display odd numbers below 100.
For Loop
Answers
Answered by
4
Program:
for i in range(1, 100):
if i%2 != 0:
print(i, end = " ")
OR
Program:
for i in range(1, 100, 2):
print(i, end = " ")
Output:
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99
More program:
Write a program in python to check whether the number is odd or even.
Program:
n = int(input("Enter a number : "))
if n%2 == 0:
print("Even")
else:
print("Odd")
Answered by
6
Answer:
hope it helps you my dear friend OK bye
Attachments:
Similar questions