R
Roy Lawson
Most of the topcoder programmers don't program in VB
(topcoder.com), so I found a topcoder-like question (not
from their site as they copyright theirs) for anyone to
tackle. I don't think this one shouldn't be too
difficult...looks real easy.
Hopefully either more VB programmers join topcoder or
someone creates a competition just for .NET programmers
because it would be nice to have someone to compare my
code to
Just keep track of your time...honor system
in full effect
Anyways, here is this one I found in a college website:
Programming Challenges: Factorial Parsing
The factorial, n!, of an integer is defined to be:
n! = ( n * ( n - 1 ) * ( n - 2 ) * ... * 2 * 1 )
An application of this formula is as follows, 5! = 5 * 4 *
3 * 2 * 1 = 120. This month's challenge is to find the
rightmost non-zero digit of n!. From the above example
this number is 2. The rightmost non-zero digit of 12! (
12! = 479001600 ) is 6.
Write a program that will input an integer between 1 and
14 inclusive and output the rightmost non-zero digit of
the factorial. For an added challenge, handle inputs
between 1 and 5000 inclusive.
Here are a few test cases for you to try:
Factorial Rightmost Non-Zero Digit
5 2
21 4
789 4
1000 2
4013 8
(topcoder.com), so I found a topcoder-like question (not
from their site as they copyright theirs) for anyone to
tackle. I don't think this one shouldn't be too
difficult...looks real easy.
Hopefully either more VB programmers join topcoder or
someone creates a competition just for .NET programmers
because it would be nice to have someone to compare my
code to

in full effect

Anyways, here is this one I found in a college website:
Programming Challenges: Factorial Parsing
The factorial, n!, of an integer is defined to be:
n! = ( n * ( n - 1 ) * ( n - 2 ) * ... * 2 * 1 )
An application of this formula is as follows, 5! = 5 * 4 *
3 * 2 * 1 = 120. This month's challenge is to find the
rightmost non-zero digit of n!. From the above example
this number is 2. The rightmost non-zero digit of 12! (
12! = 479001600 ) is 6.
Write a program that will input an integer between 1 and
14 inclusive and output the rightmost non-zero digit of
the factorial. For an added challenge, handle inputs
between 1 and 5000 inclusive.
Here are a few test cases for you to try:
Factorial Rightmost Non-Zero Digit
5 2
21 4
789 4
1000 2
4013 8