A flowchart is a diagram that depicts the steps involved in solving a problem. The following flowchart shows how to output the multiplication table ( n * 1 to n * 10) of a number, n:
If n equals 10, the output will be 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.
The start symbol marks the start of the flowchart. The parallelogram is called the input/output symbol and is used to indicate user input or output. Here, it is used to take the input, n. The rectangle is called the process symbol and shows internal operations like a variable assignment. Here, it indicates that counter is set to 1.
The decision symbol is diamond-shaped and used to indicate the possible paths a program can take based on a condition. Here, it is checked if counter is less than or equal to 10. If it is:
the result of the multiplication of n with counter is displayed as shown in the output symbol
counter is incremented as shown in the process symbol
the condition is checked again
If counter is greater than 10, the end symbol indicates the end of the flowchart.
Let's verify the logic depicted above in our flowchart for the multiplication table of
#include <iostream>using namespace std;int main() {int n;cin >> n; //Enter a inputint counter = 1;cout << endl;while (counter <= 10) {cout << n << " * " << counter << " = " << (n * counter) << endl;counter = counter + 1;}return 0;}
Enter the input below
Free Resources