Site icon TestingDocs.com

Raptor flowchart to find the number of digits in a number.

Overview

In this post, we will design a Raptor flowchart to find the number of digits in a number. Let’s design a flowchart to accept only good data. In this case, good data is positive numbers.

We will design the flowchart to be intelligent to reject invalid inputs like strings. Furthermore, the flowchart only accepts positive numbers as input.

Sample Inputs

For example Some of the test cases

Input: 6784

Number of digits = 4

Input: 67856

Number of digits = 5

Flowchart

We will design the flowchart as a Raptor procedure that calls itself. The main will invoke this procedure for the first time.

 

 

The procedure in the flowchart is recursive and intelligent. It tracks the valid input with a boolean flag.(validFlag) .The boolean variable is initially set to False. If the input data is valid the validFlag variable is set to True.

The flowchart rejects invalid data and calls itself if it detects invalid inputs like strings, negative numbers.

 

Sample Output

All the invalid recursion call stack is rejected and the valid one is executed in the flowchart.

 

User Input =www.TestingDocs.com
Error: Enter valid number. Please try again.
User Input =-79
Enter Positive Number
User Input =67856
Number of digits in the number=5

 

We can see that the flowchart rejected Strings and negative numbers as invalid input. The limitation of the flowchart is that it only works for numbers and not for floating-point numbers like 6784.85

Raptor Tutorials on this website can be found at:

https://www.testingdocs.com/raptor-a-flowchart-tool/

RAPTOR official website: https://raptor.martincarlisle.com/

Exit mobile version