Prime number or not in swift the basic set of program in every programming language swift basics.

There are two different set of loops were used to print the output. If else function prints the output only it satisfies the condition only.

## Prime Number and How to Calculate

A prime number is a number bigger than one that has only two factors: itself and one.

A prime number cannot be divided by another prime number without a remainder.

13 is an example of a prime number, although 15 is not because it may be divided by 5, 3, and 1, as well as by itself and 1.

A prime number is a number higher than 1 that has exactly two elements, namely 1 and the number itself.

In other words, a prime number is one that cannot be divided into equal groups.

Only if a number can be factorised as a product of two numbers can it be divided into groups with equal numbers of items/elements.

## If Else Statement in Swift

If a particular condition is true, the if/else statement executes a block of code.

Another block of code can be performed if the condition is false.

The if/else statement is part of JavaScript’s “Conditional” Statements, which are used to conduct various actions depending on certain situations.

## Break Statement in Swift

The Break Statement is a loop control statement used to end the loop.

The loop iterations stop as soon as the break statement is encountered within a loop, and control returns from the loop to the first statement after the loop.

With this method we can execute prime number or not in swift

## Operator in Swift

An operator is a character in mathematics and computer programming that represents an action, such as the arithmetic operator x, which represents multiplication.

The Boolean operators, one of the most well-known sets of operators, are used in computer programs to work with true/false values.

Operators are a subset of functions that take one or more arguments and return a new value.

Operators include things like addition (+), subtraction (-), multiplication (*), and so on. Variables and constants are operated on with the help of operators.

```
var value=0
var n = 10
var i = 2
for i in 2 ... n-1
{
if(n%i==0)
{
value = 1;
break;
}
}
if(value==1)
{
print("\(n)" + " not prime)
}
else
{
print("\(n)" + " prime")
}
```

Output:

10 is not prime

Swapping of Two Numbers in C Without Temporary Variable

C Program to Swap Two Numbers Using Functions

C Program to Swap Two Numbers Using Pointers

C Program to Reverse a Number Using Recursion

Reverse a Number in C Using Function

C Program to Check Vowel or Consonant Using Function

Leap Year Program in C Using Function

Factorial Program in C Using Recursion