Advertisement
ayshan

count the number of even and odd numbers in range

Mar 24th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. a,b=map(int,input().split())
  2. count_even=0
  3. count_odd=0
  4. for d in range(a,b+1):
  5. if d%2==0:
  6. count_even+=1
  7. else:
  8. count_odd+=1
  9. print("number of even numbers",count_even)
  10. print("number of odd numbers",count_odd)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement