## Computer Science & Engineering Problem Solving Lab Experiments

# Factorials

Although the factorial function has its roots in combinatorics, formulas involving factorials occur in many areas of mathematics.

There are n! different ways of arranging n distinct objects into a sequence, the permutations of those objects.
Factorials occur in algebra for various reasons, such as via the already mentioned coefficients of the binomial formula, or through averaging over permutations for symmetrization of certain operations.
Factorials also turn up in calculus; for example they occur in the denominators of the terms of Taylor's formula, basically to compensate for the fact that the n-th derivative of xn is n!.
Factorials are also used extensively in probability theory.
Factorials can be useful to facilitate expression manipulation.

Here we present two problems based on factorials.

## Problem 1:

Given a positive integer, find the number of digits in the factorial of the number.

**Input Specification**

Input will contain a single positive integer N(< 10^{6}) input from keyboard.

**Output Specification**

Output must be the number of digits in the factorial of the given number.

**Sample Input and Output**

Input: 5

Output:2

Input: 52

Output: 68

## Problem 2:

Find the number of zeroes at the end of factorial of a number.

**Input Specification**

Input will contain a single positive integer N input from keyboard, lesser than 10^9.

**Output Specification**

Output must be the number of zeroes at the end of the factorial of the given number.

**Sample Input and Output**

Input: 5

Output:1

Input: 25

Output: 6