{"id":5895,"date":"2017-01-03T15:25:40","date_gmt":"2017-01-03T15:25:40","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=5895"},"modified":"2024-09-04T07:34:40","modified_gmt":"2024-09-04T07:34:40","slug":"flowchart-to-calculate-total-and-average-of-array-elements","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/flowchart-to-calculate-total-and-average-of-array-elements\/","title":{"rendered":"Flowchart to calculate total and average of array elements"},"content":{"rendered":"<h2>Flowchart to calculate total and average of array elements<\/h2>\n<p>In this flowchart, we will compute the total and average of the array elements. Total is the sum of all the elements in the array. Average is total divided by the number of elements in the array.<\/p>\n<p>To read values into an array, follow the link:<\/p>\n<p><strong><a href=\"https:\/\/www.testingdocs.com\/questions\/how-to-read-values-into-an-array-using-raptor-flowchart\/\">https:\/\/www.testingdocs.com\/questions\/how-to-read-values-into-an-array-using-raptor-flowchart\/<\/a><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5902 size-full\" title=\"flowchart average of array elements\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-average-marks.png\" alt=\"total and average marks\" width=\"1364\" height=\"830\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-average-marks.png 1364w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-average-marks-300x183.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-average-marks-1024x623.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-average-marks-768x467.png 768w\" sizes=\"auto, (max-width: 1364px) 100vw, 1364px\" \/><\/p>\n<h3>Pseudocode<\/h3>\n<pre>   Average(marks)\r\n    \r\n      DECLARE total\r\n      DECLARE index\r\n\r\n      total = 0\r\n      index = 1\r\n      DO UNTIL index &gt; 5\r\n         total = total + marks(index)\r\n         index = index + 1\r\n      LOOP\r\n      OUTPUT \"Total Marks =\" + total\r\n      OUTPUT \"Average :=\" + (total \/ Lenght_of(marks))\r\nEND\r\n\r\n<\/pre>\n<h3>Flowchart<\/h3>\n<p>We will take the marks array in this example. marks array holds 5 subject marks of the student Alice.In this flowchart we will compute the total marks and the average.<\/p>\n<p>Inside the loop, we will accumulate the sum of the array elements:<\/p>\n<p>total &lt;- total + marks[index]<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5903 size-full\" title=\"total and Average Flowchart\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-Average-Flowchart.png\" alt=\"total and Average Flowchart\" width=\"1661\" height=\"987\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-Average-Flowchart.png 1661w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-Average-Flowchart-300x178.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-Average-Flowchart-1024x608.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-Average-Flowchart-768x456.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/total-and-Average-Flowchart-1536x913.png 1536w\" sizes=\"auto, (max-width: 1661px) 100vw, 1661px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>After the loop we will output the total marks and calculate the average.<\/p>\n<p>Average &lt;- total\/length_of(marks)<\/p>\n<p>&nbsp;<\/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>For more information on RAPTOR, visit the official website at: <a href=\"https:\/\/raptor.martincarlisle.com\/\" rel=\"noopener\"><strong>https:\/\/raptor.martincarlisle.com\/<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Flowchart to calculate total and average of array elements In this flowchart, we will compute the total and average of the array elements. Total is the sum of all the elements in the array. Average is total divided by the number of elements in the array. To read values into an array, follow the link: [&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-5895","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\/5895","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=5895"}],"version-history":[{"count":16,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/5895\/revisions"}],"predecessor-version":[{"id":24104,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/5895\/revisions\/24104"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=5895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=5895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=5895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}