Write a program to count the number of 2s that appear in all numbers between 0 and n (inclusive)
Input: 25
Output: 9, reasoning is because (2, 12, 20, 21, 22, 23, 24, and 25. NOTE: that 22 counts for two 2s)
Please Subscribe !
►Websites:
http://everythingcomputerscience.com/
►C-Programming Tutorial:
https://www.udemy.com/c-programming-for-complete-beginners/learn/v4/overview
►Become a Patreot:
https://www.patreon.com/randerson112358
►PROGRAMMING BOOKS
C-Programming - https://www.amazon.com/gp/product/0131103628/ref=as_li_tl?ie=UTF8&tag=everythingc06-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=0131103628&linkId=764c7627ffb13944091b2ad15fb5de90
Get the Book Here:
Cracking the Coding Interview:
https://www.amazon.com/gp/product/145157827X/ref=as_li_tl?ie=UTF8&tag=everythingc06-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=145157827X&linkId=e23f7f8f90525d256b8b3e9c38276520
Get the code here:
https://github.com/randerson112358/C-Programs/blob/master/CountOf2s.c
Download
0 formats
No download links available.
Cracking The Coding Interview (Count of 2s) | NatokHD