Home » Python » Python programs

Python program to find the maximum multiple from given N numbers

Here, we are going to find the maximum 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 maximum multiple of a number x from a given set of a number (set of 5 numbers in this program).

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

Following is the code for such problem,

n = 0

num = 0

maxnum = 0

x = int(input("Enter the num of which you want to find highest multiple: "))

while n<5:
    num = int(input("Enter your number : "))
    if num%x == 0:
        if num > maxnum:
            maxnum = num
    else:
        print("Not multiple")
            
    n += 1

print("The maximum multiple :",maxnum)

Output

find maximum mulitple from given N numbers in Python






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.