Problem Solving: Finding Maximum Number

Learn to write a program using functions to find the maximum number.

In this lesson, we will write a program that takes k numbers and finds the maximum number using functions.

Maximum number

Take k numbers as input and find the maximum number.

Sample input

k = 5
20 19 30 14 50

Sample output

50

We need to find the maximum number out of k numbers. This means we will have to compare all the numbers to see the maximum number.

We have solved this problem in this lesson with an efficient solution.

Let’s take that solution and implement it using the kNumbersMaximum() function:

Get hands-on with 1200+ tech skills courses.