In this program, we will count total numbers of even numbers between 1-100.
Steps to solve the program
- Create a count variable and assign its value equal to 0.
- Use for loop with the range function to iterate over values between 1-100.
- If a number is an even number then add 1 to the count variable.
- Print the output.
count = 0
for i in range(1,101):
if i%2 == 0:
count += 1
print("Total numbers of even number: ",count)
Output :
Total numbers of even number: 50