Home » Python » Python programs

# Python program to find the least multiple from given N numbers

Here, we are going to **find the least multiple from the given N numbers using Python program**.

Submitted by Anuj Singh, on September 14, 2019

Here, we will be framing code for **finding the least multiple of a number x from a given set of numbers** (set of 5 numbers in this program, and it could be many numbers as per the problem).

There will be a problem while you go to **find the least multiple**.

There are many ways of doing this but this time, we have to thought of most computationally efficient algorithm to do so.

Using for loop and checking every time might be the thing which works better than other approached. But it about checkings of the least value to be considered for comparing.

So let's work it out.

Following is the code for such problem,

n = 0 num = 0 minnum = 13 j = 0 x = int(input("Enter the num of which you want to find least multiple: ")) while n<5: num = int(input("Enter your number : ")) if num%x == 0: j = j + 14 if j == 14: minnum = num if num < minnum: minnum = num else: print("Not multiple") n += 1 if minnum%x == 0: print("The maximum multiple :",minnum) else: print("No multiple there")

**Output**

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions