Simple calculator program in a swift basic program

Simple calculator program in swift programming language to execute the calculations like addition, subtraction, multiplication and division in swift. These calculation process were done using the symbols like +,- etc.

print("simple calculator program in swift")

var a=2

var b=2

print(a+b)

print(a-b)

print(a*b)

print(a/b)

 

Output:

Simple calculator program in swift

4

0

4

1

What are the operator to perform calculator in swift

A particular symbol or phrase called an operator is used to inspect, alter, or combine information. The addition operator ( + ) adds two numbers together, as in let I = 1 + 2, and the logical AND operator ( && ) combines two Boolean values, as in if enteredDoorCode && passedRetinaScan.

What are the mathematical operators in swift programming

A mathematical function that performs a computation on two operands is known as an arithmetic operator. They’re common in ordinary math, and most programming languages include a library of them that can be used in equations to do a variety of sequential calculations. Addition, subtraction, multiplication, and division are the four basic arithmetic operations for real numbers. The commutative, associative, and distributive characteristics are the fundamental arithmetic properties.