Swift Program to Demonstrate the Arithmetic Operators

You are currently viewing Swift Program to Demonstrate the Arithmetic Operators

Swift program to demonstrate the arithmetic operators

// Swift program to demonstrate the
// arithmetic operators

import Swift;

var num1=23;
var num2=10;
var num3=0;

// '+' operator
num3=num1+num2;
print("Addition is: ",num3);

// '-' operator
num3=num1-num2;
print("Subtraction is: ",num3);

// '*' operator
num3=num1*num2;
print("Multiplication is: ",num3);

// '/' operator
num3=num1/num2;
print("Division is: ",num3);

// '%' operator
num3=num1%num2;
print("Remainder is: ",num3);

Output

Addition is:  33
Subtraction is:  13
Multiplication is:  230
Division is:  2
Remainder is:  3


...Program finished with exit code 0
Press ENTER to exit console.

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply