Shridhar Sharma

Shridhar Sharma

  • Tech Writer
  • 5.8k
  • 2.8m

to count number of 2's from 0 to 35

Apr 7 2014 7:04 AM
Write a method to count the number of 2's between 0 and n.
EXAMPLE:
input: 35
output: 14 [list of 2's: 2, 12, 20, 21, 22, 23, 24, 25, 26, 27,28, 29, 32]

Answers (4)