Flowchart

Flowchart

All About how to start with flowchart and be comfortable with it

Intro of Flowchart

Basically Flowchart is know as a diagram that represents an algorithm. we use flow chart for breaking down the problem for better understanding before goin to write code.

Here is some step to think about how to breakdown problem or think about problem

  1. Analyse your problem
  2. Break down problem in smaller sub parts
  3. Write down solution on paper
  4. verify your solution
  5. write code

    So, in this tut we're going to discuss only on 1st to 4th step later we are discuss about 5th step.


Why Flowchart

we need cause after that possibility more less to get error rather than just writing code and also we can communicate with problem with help of flow chart (what dose it mean it mean we can understand more easily what's going on in problem).

Flowchart Components

  • Terminators

Start : Mainly used to denote the start point of the program
End : Used to denote the end point of the program.

  • Input/Output

Read var : Used for taking input from the user and store it in variable ‘var’
Print var : Used to output value stored in variable ‘var’.

  • Process

Used to perform the operation(s) in the program. For example: Sum(2, 3) just performs arithmetic summation of the numbers 2 and 3.

  • Decision

Used to make decision(s) in the program means it depends on some condition and answers in the form of TRUE(for yes) and FALSE(for no).

  • Arrows

Generally, used to show the flow of the program from one step to another. The head of the arrow shows the next step and the tail shows the previous one.

  • Connector

Used to connect different parts of the program and are used in case of break-through. Generally, used for functions(which we will study in our further sections).

Let's go through some example for more understanding

Example1 : Suppose we have to make a flowchart for adding 2 numbers.

solution : Flowchart to Add Two Numbers.jpg

Example2 : Suppose we have to make a flowchart of Decision making

solution :

Here leave home considered as start and reach school as end.

Flowchart-Example2.jpg

Now I hope you can figure out how to use decision(also called diamond shaped) making problem.

Now do some problem with pen and paper for more understanding other wish it can be you easily forget thing.

  1. Check weather number is odd even.

    Note: Operator % is used to find the remainder of a number with respect to another number. for ex : 4 % 3 = 1 or 10 % 5 = 0

  2. Find largest of three number.

  3. Find sum of numbers form 1 to N.
    (Hint: Think about loop rather then writing same thing)
  4. Find largest of N numbers (just think about other then u can do google for better understating)
  5. Check weather number is prime or not.