# Overview

In this tutorial, we will look at a simple Flowgorithm flowchart example. We will design a flowchart to reverse a given number. Let’s first see a sample example input and output of the flowchart.

**Example**

If the user provides the following input to the flowchart : 7836

The expected output of the flowchart is : 6387

## Psuedocode

*START*

*DECLARE Integer number, digit, result*

*SET result = 0*

*DISPLAY “Please enter a number = “*

*IINPUT number*

*DISPLAY “Given number = “, number*

*WHILE number >= 1*

* SET digit = number MOD 10*

* SET result = result * 10 + digit*

* SET number = number / 10*

*ENED WHILE*

*DISPLAY “Reverse of the number = “, result*

*END*

## Flowgorithm Flowchart Example

We will prompt the user for a number. We will store this in a variable *number*.

Using the WHILE loop statement, inside the loop:

We will extract each digit of the given number.

number MOD 10

This will give the last digit of the number. We will store this digit in a variable *digit.*

For example, 1345 MOD 10 will store 5 in the *digit*.

We will build the reverse of the number using the variable *result*

number / 10

We move to the next digit by dividing the number by 10.

For example,

number = 1345 / 10 will store 134 in the variable *number*.

When all the digits are covered in the *number variable*, it will become 0. The WHILE loop terminates as the loop condition is evaluated to False.

## Sample Output

Run the flowchart and verify the output of the flowchart.

—

**Flowgorithm Tutorials**

Flowgorithm flowchart tutorials on this website:

https://www.testingdocs.com/flowgorithm-flowchart-tutorial/

For more updates please like our Facebook page: