{"id":6480,"date":"2017-01-19T05:21:14","date_gmt":"2017-01-19T05:21:14","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=6480"},"modified":"2021-03-17T09:40:29","modified_gmt":"2021-03-17T09:40:29","slug":"raptor-flowchart-to-find-the-number-of-digits-in-a-number","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/raptor-flowchart-to-find-the-number-of-digits-in-a-number\/","title":{"rendered":"Raptor flowchart to find the number of digits in a number."},"content":{"rendered":"<h3>Overview<\/h3>\n<p>In this post, we will design a Raptor flowchart to find the number of digits in a number. Let&#8217;s design a flowchart to accept only good data. In this case, good data is positive numbers.<\/p>\n<p>We will design the flowchart to be intelligent to reject invalid inputs like strings. Furthermore, the flowchart only accepts positive numbers as input.<\/p>\n<h3>Sample Inputs<\/h3>\n<p>For example Some of the test cases<\/p>\n<p>Input: 6784<\/p>\n<p>Number of digits = 4<\/p>\n<p>Input: 67856<\/p>\n<p>Number of digits = 5<\/p>\n<h3>Flowchart<\/h3>\n<p>We will design the flowchart as a Raptor procedure that calls itself. The main will invoke this procedure for the first time.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6484\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Main-Flowchart-Number-of-Digits.png\" alt=\"Main Flowchart Number of Digits\" width=\"1682\" height=\"824\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Main-Flowchart-Number-of-Digits.png 1682w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Main-Flowchart-Number-of-Digits-300x147.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Main-Flowchart-Number-of-Digits-1024x502.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Main-Flowchart-Number-of-Digits-768x376.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Main-Flowchart-Number-of-Digits-1536x752.png 1536w\" sizes=\"auto, (max-width: 1682px) 100vw, 1682px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>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.<\/p>\n<p>The flowchart rejects invalid data and calls itself if it detects invalid inputs like strings, negative numbers.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6487\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Get-Number-of-Digits-of-a-Number.png\" alt=\"Get Number of Digits of a Number\" width=\"1460\" height=\"1635\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Get-Number-of-Digits-of-a-Number.png 1460w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Get-Number-of-Digits-of-a-Number-268x300.png 268w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Get-Number-of-Digits-of-a-Number-914x1024.png 914w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Get-Number-of-Digits-of-a-Number-768x860.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Get-Number-of-Digits-of-a-Number-1372x1536.png 1372w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><\/p>\n<h3>Sample Output<\/h3>\n<p>All the invalid recursion call stack is rejected and the valid one is executed in the flowchart.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6488\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Flowchart-Input-for-Number-of-Digits.png\" alt=\"Flowchart Input for Number of Digits\" width=\"1910\" height=\"981\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Flowchart-Input-for-Number-of-Digits.png 1910w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Flowchart-Input-for-Number-of-Digits-300x154.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Flowchart-Input-for-Number-of-Digits-1024x526.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Flowchart-Input-for-Number-of-Digits-768x394.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Flowchart-Input-for-Number-of-Digits-1536x789.png 1536w\" sizes=\"auto, (max-width: 1910px) 100vw, 1910px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>User Input =www.TestingDocs.com<br \/>\nError: Enter valid number. Please try again.<br \/>\nUser Input =-79<br \/>\nEnter Positive Number<br \/>\nUser Input =67856<br \/>\nNumber of digits in the number=5<\/p>\n<p>&nbsp;<\/p>\n<p>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<\/p>\n<p>Raptor Tutorials on this website can be found at:<\/p>\n<p><a href=\"https:\/\/www.testingdocs.com\/raptor-a-flowchart-tool\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>https:\/\/www.testingdocs.com\/raptor-a-flowchart-tool\/<\/strong><\/a><\/p>\n<p>RAPTOR official website: <a href=\"https:\/\/raptor.martincarlisle.com\/\" rel=\"noopener\"><strong>https:\/\/raptor.martincarlisle.com\/<\/strong><\/a><\/p>\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-6480\" data-postid=\"6480\" class=\"themify_builder_content themify_builder_content-6480 themify_builder tf_clear\">\n    <\/div>\n<!--\/themify_builder_content-->\n","protected":false},"excerpt":{"rendered":"<p>Overview In this post, we will design a Raptor flowchart to find the number of digits in a number. Let&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[187],"tags":[208],"class_list":["post-6480","post","type-post","status-publish","format-standard","hentry","category-flowchart","tag-mathematics","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/6480","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=6480"}],"version-history":[{"count":18,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/6480\/revisions"}],"predecessor-version":[{"id":19360,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/6480\/revisions\/19360"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=6480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=6480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=6480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}