Given an integer **N ≥ 1**, the task is to find the smallest **N** digit number which is a multiple of **5**.

**Examples:**

Input:N = 1

Output:5

Input:N = 2

Output:10

Input:N = 3

Output:100

**Approach:**

- If
**N = 1**then the answer will be**5**. **If N > 1**then the answer will be**(10**because the series of smallest multiple of^{(N – 1)})**5**will go on like**10, 100, 1000, 10000, 100000, …**

Below is the implementation of the above approach:

## C++

`// C++ implementation of the approach ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to return the smallest n digit ` `// number which is a multiple of 5 ` `int` `smallestMultiple(` `int` `n) ` `{ ` ` ` `if` `(n == 1) ` ` ` `return` `5; ` ` ` `return` `pow` `(10, n - 1); ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `int` `n = 4; ` ` ` `cout << smallestMultiple(n); ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java implementation of the approach ` `class` `GFG { ` ` ` ` ` `// Function to return the smallest n digit ` ` ` `// number which is a multiple of 5 ` ` ` `static` `int` `smallestMultiple(` `int` `n) ` ` ` `{ ` ` ` `if` `(n == ` `1` `) ` ` ` `return` `5` `; ` ` ` `return` `(` `int` `)(Math.pow(` `10` `, n - ` `1` `)); ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `main(String args[]) ` ` ` `{ ` ` ` `int` `n = ` `4` `; ` ` ` `System.out.println(smallestMultiple(n)); ` ` ` `} ` `} ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 implementation of the approach ` ` ` `# Function to return the smallest n digit ` `# number which is a multiple of 5 ` `def` `smallestMultiple(n): ` ` ` ` ` `if` `(n ` `=` `=` `1` `): ` ` ` `return` `5` ` ` `return` `pow` `(` `10` `, n ` `-` `1` `) ` ` ` `# Driver code ` `n ` `=` `4` `print` `(smallestMultiple(n)) ` |

*chevron_right*

*filter_none*

## C#

`// C# implementation of the approach ` `using` `System; ` `class` `GFG { ` ` ` ` ` `// Function to return the smallest n digit ` ` ` `// number which is a multiple of 5 ` ` ` `static` `int` `smallestMultiple(` `int` `n) ` ` ` `{ ` ` ` `if` `(n == 1) ` ` ` `return` `5; ` ` ` `return` `(` `int` `)(Math.Pow(10, n - 1)); ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `Main() ` ` ` `{ ` ` ` `int` `n = 4; ` ` ` `Console.Write(smallestMultiple(n)); ` ` ` `} ` `} ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP implementation of the approach ` ` ` `// Function to return the smallest n digit ` `// number which is a multiple of 5 ` `function` `smallestMultiple(` `$n` `) ` `{ ` ` ` `if` `(` `$n` `== 1) ` ` ` `return` `5; ` ` ` `return` `pow(10, ` `$n` `- 1); ` `} ` ` ` `// Driver code ` `$n` `= 4; ` `echo` `smallestMultiple(` `$n` `); ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

1000

**Time Complexity:** O(1)

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Smallest multiple of 3 which consists of three given non-zero digits
- Smallest K digit number divisible by X
- Smallest n digit number divisible by given three numbers
- Largest and smallest digit of a number
- Smallest N digit number divisible by N
- Find the Number which contain the digit d
- Smallest multiple of N formed using the given set of digits
- Length of the smallest number which is divisible by K and formed by using 1's only
- Smallest and Largest N-digit perfect squares
- Largest and Smallest N-digit Octal Numbers
- Biggest integer which has maximum digit sum in range from 1 to n
- Largest palindrome which is product of two N-digit numbers : Set 2
- Find the smallest number whose digits multiply to a given number n
- Get the kth smallest number using the digits of the given number
- Smallest number dividing minimum number of elements in the Array
- Number of triplets such that each value is less than N and each pair sum is a multiple of K
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Append a digit in the end to make the number equal to the length of the remaining string
- Probability that a N digit number is palindrome
- Reduce number to a single digit by subtracting adjacent digits repeatedly

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.