4
Answers

to count number of 2's from 0 to 35

Photo of Shridhar Sharma

Shridhar Sharma

11y
1.5k
1
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)