Answer: because that those who don’t know what factorial is, 100! = 100 * 99 * 98 * … * 2 * 1

Ok, let’s look at how trailing zeros are created in the very first place. A trailing zero is created when a lot of of 5 is multiplied through a multiple of 2. Now all we need to do is counting the number of 5’s and also 2’s in the multiplication.

You are watching: How many zeros in 100!

Let’s count the 5’s first. 5, 10, 15, 20, 25 and also so on making a total of 20. However there is an ext to this. Since 25, 50, 75 and also 100 have actually two 5’s in every of them (25 = 5 * 5, 50 = 2 * 5 * 5, …), you need to count them twice. This makes the grand total 24. For world who prefer to look at it from a formula suggest of view

Number that 5’s = 100/5 + 100/25 + 100/125 + … = 24 (Integer values only)


Moving top top to counting the variety of 2’s. 2, 4, 6, 8, 10 and so on. Full of 50 multiples of 2’s, 25 multiples the 4’s (count these when more), 12 multiples that 8’s (count these once more) and also so on… The grand complete comes the end to

Number of 2’s = 100/2 + 100/4 + 100/8 + 100/16 + 100/32 + 100/64 + 100/128 + … = 97 (Integer worths only)

Each pair that 2 and also 5 will reason a rolling zero. Because we have actually only 24 5’s, we deserve to only do 24 bag of 2’s and also 5’s thus the number of trailing zeros in 100 factorial is 24.

If girlfriend have any kind of questions, please feel complimentary to send me an email at . If girlfriend have any type of interview concerns which you feeling would benefit others, I would love to hear around it.


Continue reading Below

If you favor this post, please Digg that or provide it a thumbs increase on StumbleUpon.

See more: Langston Hughes Juke Box Love Song, Jukebox Love Song

If you're searching for some significant preparation for her interviews, I'd introduce this publication written by a lead Google interviewer. It has 189 programming questions and also solutions:
*

Related posts:


6 Comments
Filed in Puzzles
post by john Sonmez
Tagged easy, mathematics, numbers, puzzle

6 Responses


Leave a Reply


Click right here to cancel reply.


Using Gravatars in the comments - acquire your own and also be recognized!

XHTML: this are several of the tag you can use:


My tech Interviews is it is provided by WordPress using theme Tribune
report this ad

Search Interview Questions


Random

report this ad

Categories

report this ad

Archives


report this ad
x
x