In this tutorial, We will share a swift program to find the maximum of two numbers with an example and real-time output. This is a very basic program in Swift programming language. If you are Swift beginners or want to start learning Swift programming language, then this program will help you to understand the basic Swift programming.
In the below example we have used
max() function to determine the maximum number from given two numbers.
Copy the below program and create a file named “maxNumber.swift” and execute it.
let first = 10
let second = 15
let largest = max(first, second)
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected].com. Your article will appear on the FreeWebMentor main page and help other developers.