Pseudocode and Flowchart

Nishalini cithirangathan
3 min readSep 3, 2023

--

Good, logical programming is developed through good pre-code planning and organization. This is assisted by the use of pseudocode and program flowcharts.

Flowcharts are written with program flow from the top of a page to the bottom. Each command is placed in a box of the appropriate shape, and arrows are used to direct program flow. The following shapes are often used in flowcharts:

Pseudocode is a technique for discussing computer algorithms that combines programming language with everyday English. It is essentially a step along the way to writing the actual code. It enables the programmer to develop ideas about the structure and flow of a computer algorithm without having to adhere to the precise coding syntax. Although pseudocode is commonly employed, its precise application is not governed by any set of standards. Here are some general guidelines that are frequently adhered to when producing pseudocode:

The standard Fortran symbols (+, -, *, /, **) are used for arithmetic operations.
To represent the quantities being processed, symbolic names are utilised.
It is possible to utilise Fortran keywords like PRINT, WRITE, READ, etc.
To denote branches and loops in an instruction, use indentation.

Here is an illustration of an issue, complete with a flowchart, pseudocode, and Fortran 90 programme. This issue and its answer are taken from Nyhoff, page 206:

What is the smallest positive integer number for which the sum equals a specified value, Limit?

1 + 2 +… + Number is the sum.

exceeds the Limit. What does this Sum’s value equal?

Pseudocode:

a number as an input Limit
Output: Number and Sum as two integers.

  1. Type a Limit
    Set Number = 0, or 2.
    Set Sum = 0 3.
    4. Say the following again:
    a. Stop the repetition if Sum > Limit; else, continue.
    b. Add one to the number.
    c. Add Number to Sum, then adjust so that it equals Sum.
    5. Print the sum and number.
  2. Flowchart:

Fortran 90 code:

PROGRAM Summation

! Program to find the smallest positive integer Number
! For which Sum = 1 + 2 + … + Number
! is greater than a user input value Limit.

IMPLICIT NONE

! Declare variable names and types

INTEGER :: Number, Sum, Limit

! Initialize Sum and Number

Number = 0
Sum = 0

! Ask the user to input Limit

PRINT *, “Enter the value for which the sum is to exceed:”
READ *, Limit

! Create loop that repeats until the smallest value for Number is found.

DO
IF (Sum > Limit) EXIT ! Terminate repetition once Number is found
! otherwise increment number by one
Number = Number + 1
Sum = Sum + 1
END DO

! Print the results

PRINT *, “1 + … + “, Number, “=”, Sum, “>”, Limit

END PROGRAM

--

--