In this post, I will explain about a Swift program to divide 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.
Before executing this program I assume you have configured swift on your computer. Copy the below program and create a file “divide.swift” and execute it.
1 2 3 4 5 6 7 8 9 10 | import UIKit var x = 15 var y = 5 var z = 0 z = x / y print("The division is:") print(z) |
The division is: 3
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: apple swift programs, division of two numbers, swift program, swift program example, Swift programming example, Swift programs, swift programs examples, Swift programs with output