Flow Charts

books for flow chats

click here 

 

Flowchart In Programming

Flowchart is a diagrammatic representation of an algorithm. Flowchart are very helpful in writing program and explaining program to others.

Symbols Used In Flowchart

Different symbols are used for different states in flowchart, For example: Input/Output and decision making has different symbols. The table below describes all the symbols that are used in making flowchart
SymbolPurposeDescription
Flowline symbol in flowchart of programmingFlow lineUsed to indicate the flow of logic by connecting symbols.
Terminal symbol in flowchart of programmingTerminal(Stop/Start)Used to represent start and end of flowchart.
Input/Output symbol in flowchart of programmingInput/OutputUsed for input and output operation.
Processing symbol in flowchart of programmingProcessingUsed for airthmetic operations and data-manipulations.
Decision making symbol in flowchart of programmingDesicionUsed to represent the operation in which there are two alternatives, true and false.
On-page connector symbol in flowchart of programmingOn-page ConnectorUsed to join different flowline
Off-page connector symbol in flowchart of programmingOff-page ConnectorUsed to connect flowchart portion on different page.
Predefined process symbol in flowchart of programmingPredefined Process/FunctionUsed to represent a group of statements performing one processing task.

Examples of flowcharts in programming

Draw a flowchart to add two numbers entered by user.
Flowchart to add two numbers in programming
Draw flowchart to find the largest among three different numbers entered by user.
Flowchart to find largest among three numbers
Draw a flowchart to find all the roots of a quadratic equation ax2+bx+c=0
Flowchart of roots of quadratic equation
Draw a flowchart to find the Fibonacci series till term≤1000.
Flowchart of Fibonacci sequence in programming
Though, flowchart are useful in efficient coding, debugging and analysis of a program, drawing flowchart in very complicated in case of complex programs and often ignored.

 

Q  Finding Prime Numbers Flow Chart - RFFlow

A Flow Chart for Finding Prime Numbers
Description Prime numbers are positive integers that can only be divided evenly by 1 or themselves. By definition, negative integers, 0, and 1 are not considered prime numbers. The list of the first few prime numbers looks like:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, ... For example, 5 is a prime number because you can divide 5 by 1 evenly and divide 5 by 5 without a remainder, but if you divide 5 by any other integer, you get a remainder.

5/1 = 5
5/2 = 2 plus a remainder
5/3 = 1 plus a remainder
5/4 = 1 plus a remainder
5/5 = 1
5/6 = 0 plus a remainder
...   = 0 plus a remainder

Now look at the number 4 which is not a prime.

4/1 = 4
4/2 = 2
4/3 = 1 plus a remainder
4/4 = 1
4/5 = 0 plus a remainder
...  = 0 plus a remainder

The number 4 can be divided by 2 evenly, so it is not a prime.

The flowchart shown above describes a function that is given a number i and returns whether it is prime or not. The name of the function is "IsThisNumberPrime."  First it checks to make sure the input number is an integer. Then it checks to make sure the input number is not negative, 0 , or 1. Negative integers, 0, and 1 are not considered prime by definition.

Next the function tries to divide the input number by i, where i = 2, 3, 4, 5, and so forth, to see if it divides any of them evenly, that is, without a remainder. If the input number is divided evenly, it is not a prime. The check stops when i is equal to the input number.

You give the function a number and the output is "Yes" if the number is prime, or "No" if it is not.

Now suppose you want to calculate the first 100 prime numbers. A flowchart to show that process is shown below.




The flowchart above starts with the number 2 and checks each number 3, 4, 5, and so forth. Each time it finds a prime it prints the number and increments a counter. When the counter hits 100, it stops the process. To determine whether a number is prime, it calls the function "IsThisNumberPrime" which is shown at the top of this page.

The first few primes are quickly calculated, but as the primes get further apart the computation time increases. Finding large primes is a task for super computers.
Drawing Instructions If you haven't already done so, first download the free trial version of RFFlow. It will allow you to open any chart and make modifications.

Once RFFlow is installed, you can open the above charts in RFFlow.  Click on prime-numbers.flo for the top flow chart or finding-prime-numbers.flo for the bottom flow chart. From there you can zoom in, edit, and print these sample charts. It is often easier to modify an existing chart than to draw it from scratch.

To draw this flow chart without downloading it, run RFFlow, click on the More Shapes button , scroll and open the Flowcharting folder, click the Physical Flowcharting stencil and click the Add Stencil button.

 

if else statement and flowchart

Decision Control Statements and Flowchart

The if Statement
It is used to execute an instruction or sequence/block of instruction only if a condition is fulfilled.
Difference forms of implements if-statement are:

  • Simple if statement
  • if-else statement
  • Nested if-else statement
  • else if statement
simple if statement syntax and flowchart
Figure: Simple if statement syntax and flowchart

if-else statement syntax and flowchart
Figure: if-else statement syntax and flowchart


Nested if-else statement
In nested if...else statement, an entire if...else construct is written within either the body of the if statement or the body of  an else statement.
The syntax is as follows:
if(condition_1)
{
 if(condition_2)
 {
   block statement_1;
 }
 else
 {
   block statement_2;
 }
}
else
{
  block statement_3;
}
block statement_4;

nested if else flowchart
Figure: nested if-else statement flowchart


Else if statement
It is used in multi-way decision on several conditions. This works by cascading comparisons. As soon as one of the conditions is true, the statement or block of statements following them is executed and no further comparison are performed.
The else...if syntax is as follows:

if(condition_1)
  block statement_1;
else if(condition_2)
  block statement_2;
else if(condition_n)
  block statement_n;
else
  default statement;

else...if flowchart statement
Figure: flowchart for else...if statement

Flowchart for finding Armstrong number

Q. Write down the program for finding Armstrong number and also draw flowchart.

Ans.

for Armstrong number C program source code click below link:
Finding Armstrong number C program

Flowchart for finding Armstrong number C program:

Flowchart for check, a number is Armstrong or not C program
Figure: Flowchart for finding number is 
Armstrong or not C program

Factorial C program,Algorithm,Flowchart

Q. Write a C program to find the factorial value of a number. Also write the algorithm and draw flowchart.

Ans.

/*c program to find out factorial value of a number*/
#include<stdio.h>
#include<conio.h>
int main()
{
 int n,i,fact=1;
 printf("Enter any number : ");
 scanf("%d", &n);
 for(i=1; i<=n; i++)
    fact = fact * i;
 printf("Factorial value of %d = %d",n,fact);
 return 0;
}

The output of above program would be:



Algorithm for calculate factorial value of a number:

[algorithm to calculate the factorial of a number]
step 1. Start
step 2. Read the number n
step 3. [Initialize]
        i=1, fact=1
step 4. Repeat step 4 through 6 until i=n
step 5. fact=fact*i
step 6. i=i+1
step 7. Print fact
step 8. Stop
[process finish of calculate the factorial value of a number]

Flowchart for calculate factorial value of a number:


flowchart for calculate factorial value of a number
Figure: Flowchart for calculate factorial value of
a number C program

Flowchart for prime number

Q. Draw the flowchart diagram for check a number is prime number or not.

Ans.

Flowchart for check a number is prime or not as following:

flowchart of check a number is prime number or not Figure: Flowchart for check given number is
prime number or not
 

31 comments:

  1. Bravo i must say this is Brilliant!!!!

    ReplyDelete
  2. Nice flowchart diagrams. What is the flowchart software you used to create these flowchart diagrams ? Is it creately?

    ReplyDelete
  3. A company’s salesmen are selling toothpaste and tooth powder. The company having 50 salesmen gives 10% commission on the sale of toothpaste and 20% commission on tooth powder. Draw a flowchart to compute and print the total sale and the total commission for each salesman.

    ReplyDelete
  4. Thanks for the explanation and examples,but I wonder if the middle print command in the second example of deciding the biggest of three numbers should be C not B. and the left one should be B not C; in other words, they should be switched.

    ReplyDelete
    Replies
    1. you might be right. I encountered the problem. Good job though.

      Delete
    2. Sorry my চিষ্টেম write আৰু thank you for be answer

      Delete
  5. In "Flowchart for prime number "
    FLAG=1 and its never equal to 0... Then further step is not going to execute...[steps when the value is true] only the value for false condition is going to run which gives "Print number is prime" all the time......
    Does FLAG have special meaning????

    ReplyDelete
  6. Also to mention, rest of the flowcharts helped me a lot and I am thankful for that..... Next thing I have to say is:: "books for flow chats
    click here" at the top.... There is spelling error. Good for you if your corrected that...Thanks indeed...

    ReplyDelete
  7. Whoa!!! Aren't these your own contents????? You have just copied others content......
    I found the same thing on the website:
    http://www.rff.com/prime-numbers.htm
    Is this your website....??? I don't think so...

    ReplyDelete
  8. the largest among 3 numbers has a little correction i think.

    ReplyDelete
  9. Your Questions find prime numbers flow chart very long.
    I solve it very sort

    ReplyDelete
  10. clear explanation.......nice

    ReplyDelete
  11. The flowchart which is used to find the largest of three numbers contain an error in it so kindly rectify that as soon as possible.thank you

    ReplyDelete
  12. Send mi. How can write algorithum & flowchart for user define function orrecursion

    ReplyDelete
  13. one of the indian bank that also give loans is facing problem of doing data entry manually of loan application & then checking manually if the application is eligible for loans .Hence it has requested you to develop a software stystem which can
    The data entry operators directly input the data into the software.There are certain fields that are considerd to be mandatory, hence if data is not enterd in those fields the application is rejected
    Once the data is updated into the database then automatically do a credit risk check(referred to as credit rules) of whether the application is eligible for loanor not
    in case yes, then what should be the amount uoto which the loan can be given?
    Then finally compute the loan approved amount(LAA) that would be the lower of the two i.e the loan eligibility amount(LEA) or the loan requested amount(LRA)
    note that the system needs to be designed in such a way that credit ruels can be easily added or modified or new rules introdused & some old rules removed
    Not that for different kinds of loans (i.e housing loans,vehicle loans) there would be different set of credit rules.Also for different Loans types, Some fields shall be mandatory for loan types & some fields only specific to that loan Type

    You are required to develop:
    A) Business Flow(Flow Chart)

    ASSUMPTIONS:
    Field included in a loan application from:
    1. Name
    2.City
    3.Age
    4.Vehicle Details(mandatory for vehicle loan)
    5.House details(mandatory for house loan)
    6. Occupation Types(OT) status:
    a)N=Not working b)E=Employed c)B=Business(the data entry operator shall get a Drop Down for this field in the software screen & shall select one of the three values from above. In the system ,the are coded as N or E or B
    7.Loan Request Amount(LRA)
    8.Annual income as per income tax return
    9.Previous loan outstanding- ?Yes or No
    10.Previous loan amount(PLA) (if the above is true this field shall get active & becomes a mandatory for input)
    11.Passport no.(Compulsory):
    Bank's criteria or Rules to approve loans and the amounts thereof are

    1.Gives loan to person of age between 18 to 60 years
    2.if person is running a business then ,eligibility is 20% lower than the loan eligible amount that would be computed from the below tabel
    3.this table gives a decision table to show the income range of the applicant & the way to compute the loan eligible amount
    Annual income range | loan eligible Amount
    0-2lacs | not eligible amount
    2-5lacs | 50% of the avg.annual salary
    5-10lacs | 80% of the avg.annual salary
    10lacs&above | 75% of the avg.annual salary
    4.Maximum LAA can notexceed 1 crore

    ReplyDelete
  14. Very informative blog!

    Please take some time to visit my blog @
    Flowchart in Computer programming

    Thanks!

    ReplyDelete
  15. it was useful to me for my mid examination .thank you so mutch.keep up the good work.god bless you

    ReplyDelete
  16. How to write a flowchart by storing numbers in an array and print
    Them

    ReplyDelete
  17. You are doing great job for students

    ReplyDelete
  18. Draw a flow chart for the computer program that takes number A and B and divide them as (answer= A/B). 3 should always be greater than 0 a program should print "invalid number" if the inserted number is less than or equal to zero and faros the user to retype the number

    ReplyDelete
  19. Input a number and draw a flow chart to print mathematical table of the number (use
    loop).
    Eg: 5x1 = 5
    5 x 2 = 10
    5x3 = 15

    5 x 10 = 50
    Urgent needs the answer

    ReplyDelete
  20. Thanks buddy it was useful for me

    ReplyDelete
  21. Create a flow chart that will identify if the user input number is a zero or real nonzero number, Then translate it into java codes
    NOTE : A real nonzero number must be either positive or negative numbers

    ReplyDelete
  22. Develop a flowchart to calculate the tuition fee for a student at an University. The program should prompt for and accept the idnumber and the total number of credits for which he/she has enrolled. The bill outputted should contain the idnumber and tuition fee.
    Calculate the tuition fee as follows:
    Total credits of 15 or more indicates that the student is full-time. Full-time students pay a flat rate of $35,000 for tuition.
    Total credits of less than 15 indicate that the student is part-time. Part-time students pay $850 per credit for tuition.
    After printing the tuition fee, ask the user if s/he wants to calculate the tuition fee for another student – “Y” for yes and “N” for no. (This question is asked each time the tuition fee is printed). If s/he does, allow him/her to enter another student’s idnumber and total number of credits and find the tuition fee again. If the answer is no, the flowchart must be terminated with an appropriate message.

    ReplyDelete