# Flowchart or Algorithm of Prime, Reverse, Largest Number

## Algorithm Prime

### Q) Draw the flowchart and write an algorithm to determine whether a number is prime or not.

- This is the algorithm to determine whether a number is prime or not.
- n-Accepted number
- i-loop variable

Image Source ~ Crafted With ©Ishwaranand - 2020 ~ Image by ©Ishwaranand |

step 1: start

step 2: [Accept a number] read n

step 3: set i = 2

step 4: Repeat steps 5and 6 until i < n

step 5: [ check whether n is divisible or not]

if n % i == 0 then

Goto step7

Else

Goto step6

step 6: set i = i + 1

step 7: if i == n then

Print "number is prime"

Else

Print "number is not prime"

step 8: stop

## Algorithm Reverse

### Q) Draw the flowchart and write an algorithm to find the reverse of a given number.

- This is the algorithm to print reverse of an accepted number
- n- Accepted number
- r- variable for remainder
- rev- the reverse of a number

Image Source ~ Crafted With ©Ishwaranand - 2020 ~ Image by ©Ishwaranand |

step 1: start

step 2: read n

step 3: Set rev=0

step 4: repeat steps 5,6 & 7 unit n!=0

step 5: set r = n % 10

step 6: set rev = rev*10 + r

step 7: set n=n/10

step 8: print rev

step 9: stop

## Algorithm largest

### Q) Draw the flowchart and write an algorithm to find the largest of a given number.

- This is the algorithm to find largest of three numbers a,b,c - Accepted numbers

Image Source ~ Crafted With ©Ishwaranand - 2020 ~ Image by ©Ishwaranand |

step 1 Start

step 2 [Accepted three number]

read a,b,c,

step 3 if a > b then

if a > c then

Print a is the largest

Else

Print c is the largest

Else

if b > c then

Print b is the largest

Else

Print c is the largest

step 4: stop