Photo Credit: @divinetechygirl.
Flowcharts are the graphical representations of the solution to a problem. In the simplest terms when we try to solve a problem, we sometimes try to scribble our understanding on a piece of paper which helps us solve the problem. The same thing we do for solving logical problems. We plan and propose our solution graphically drawing the flow of how we are going to address the problem. So let’s learn to create flowcharts.
Start & Stop – Oval symbols indicate where the flow of solution starts and where it ends.
Input & Output – We use tilted rectangles or corner-cut rectangle symbols to take or give data to/from the user.
Processing & Calculating – We use Square or Rectangle symbols when we are doing some internal processing or calculation, without any input from the user or without giving any output to the user.
Decision – We use the Rhombus symbol to indicate decision markers where the flow may take a different route based on a condition.
Connector – If our chart is turning complicated and we need to jump to or jump from one route to another, we use connectors, representing a connection by mentioning a number within a circle.
There are many more advanced symbols, which is beyond the scope of this scope. I will mention them, on a need basis. For now, let’s start plotting some flowcharts using the above-mentioned basic symbols.
Example #1. How to Cook noodles?
Solution:
I am sure you can make far better noodles than me, but hopefully, this gives you a clear picture of how flowcharts can help us plan our logical solution and write flawless code.
Next, we will take up some small mathematical problems and solve them through a flowchart.
Let us start with a simple flowchart example to find out, the highest number among two given numbers.
Example #2. Which number is the highest among the given two numbers?
Let’s make it a little more complex. Shall we?
Example #3. Which number is the highest among the given three numbers?
Now let us try some arithmetic.
Example #4. Take any two numbers, add them, and show the result.
Too simple? Let us add a little more complexity to it and spice it up.
Example #5. Program a basic calculator to operate on two numbers based on the operation selected by the user.
Practice a few by yourself. Can you plot a flowchart for the Magic Trick? Let me know. Drop a mail, if you wish me to share the flowchart for the Magic Trick.