Total numbers of odd numbers between 1-100

In this program, we will total numbers of odd numbers between 1-100 .

Steps to solve the program
  1. Create a count variable and assign its value equal to 0.
  2. Use for loop with the range function to iterate over values between 1-100.
  3. If a number is an odd number then add 1 to the count variable.
  4. Print the output.
count = 0

for i in range(1,101):
    if i%2 != 0:
        count += 1

print("Total numbers of odd number: ",count)

Output :

Total numbers of odd number:  50

count total numbers of even numbers between 1-100

get input from the user if it is a number insert it into an empty list

Leave a Comment