A program is a sequence of instructions that enables the computer to solve a problem. Writing a program to solve the problem can be a formidable task if the problem is complex. The overall programming process can often be simplified by using a top-down approach. The process is called a top-down design because the programmer starts with the original problem and breaks it down into smaller tasks which can be addressed separately. First, the large tasks are identified and then each of these tasks is refined filling in more details. This process allows the programmer to initially concentrate on the overall steps without getting bogged down in the details of the program, thus making the programming task more manageable. Another advantage of breaking a program down into tasks is that each task can be checked for correctness apart from the other tasks. An algorithm or plan, in the form of a flowchart or pseudocode (English-like statements), can be used to describe the problem solving process.

Example - Surface area and volume of a sphere

Problem Statement

Find the surface area and volume of a sphere with a given radius.

Mathematical Equations
The surface area of a sphere is and the volume is , where r is the radius.

  1. Input the value of the radius of the sphere.
  2. Compute the surface area and volume of the sphere.
  3. Print the values of the radius, the surface area, and the volume of the sphere.


Example Output
Enter the radius of the sphere.
    64.0000 is the value of the radius.
In a sphere of radius    64.0000 , the surface area is    51471.9
 and its volume is    1.09807E+06.
Note: Very large or very small numbers may be expressed in exponential notation. A value expressed in exponential notation is written as a number between 0.1 and 10, called the mantissa, multiplied by an appropriate power of 10. The letter E separates the mantissa and the exponent of the base 10. The value 1098070 expressed in exponential notation is 1.09807E+06 which represents .

Column Format

From the time FORTRAN was invented until the mid 1970's, most FORTRAN programs were punched on 80-column cards. Since cards had 80 punched columns, they could hold a maximum of 80 characters. The column restrictions in FORTRAN 77 are a carry over from the punched cards. The 80 positions on each line are numbered from left to right and are restricted to the following use:
columns 1-5: These columns are reserved for statement labels. Statement labels are positive integers from one to five digits in length. They are not required for every statement, but are necessary for statements that are referenced by other statements.

column 6: This column is used to indicate that a statement has been continued from the previous statement. Any character, except the number zero, can be used for a continuation symbol. A FORTRAN statement may have up to 19 continuation lines.

columns 7-72: These columns are reserved for FORTRAN statements. All characters past column 72 are ignored.

Programming Style and Techniques

Your code should be easy to read and interpret. This is especially important at a later time if you or someone else updates your code. The following guides will help you develop a programming style that will enhance the readability of your code: