Виртуальная песочница (тм)

Thursday, March 29, 2012

How many zeros are there at the end of 123456789! or how does a Java developer get a job in Munich

Step #1. The Job Listing


Step #2. The Job Ad

Все детали на
{Number of zeroes at the end of 123456789!}.com
en.wikipedia.org/wiki/Factorial

Step #3. The Problem
Find the number of zeroes at the end of 123456789!

Step #4. The Solution

 01 public class FactorialTrailingZeros {
02 public static void main(String[] args) {
03 int n = Integer.parseInt(args[0]);
04 double d = n;
05 int z = 0; // zeros
06 while (d>1) {
07 d /= 5.0;
08 z += (int)Math.floor(d);
09 }
10 System.out.println(n + "! has " + z + " trailing zeros");
11 }
12 }


Step #5. The Prize




Home

Welcome at Ravensburger Digital

We are a new company of Ravensburger Group, internationally well-known for its games, puzzles and books. Our aim is to develop Ravensburger products for all major digital platforms, as well as creating innovative new product lines that fit with our brand and core values. This includes online & social platforms, PC games and mobile games & apps.

The quality that makes our games, puzzles and books stand out, will also set the standard for our digital products: high-quality entertainment for the whole family.



No comments: