You are on page 1of 16

ENF 102 Basic Computer Science and FORTRAN Programming Introduction to Programming, Sample Algorithms and Flowcharts

Dr. Tolga PIRASACI


Gazi University

Dr. Tolga PIRASACI (Gazi University)

Introduction

1 / 16

Outline

Introduction to Programming Overview of Computer Programming Overview of FORTRAN Program Algorithmic Approach and Flowcharting Examples Example-1 Example-2 Example-3 Example-4 Example-5

Dr. Tolga PIRASACI (Gazi University)

Introduction

2 / 16

Introduction to Programming

Overview of Computer Programming

Programming

Computer programming (often shortened to programming or coding) is the process of designing, writing, testing, debugging / troubleshooting, and maintaining the source code of computer programs. This source code is written in a programming language. The purpose of programming is to create a program that exhibits a certain desired behaviour. The process of writing source code often requires expertise in many dierent subjects, including knowledge of the application domain, specialized algorithms and formal logic.

Dr. Tolga PIRASACI (Gazi University)

Introduction

3 / 16

Introduction to Programming

Overview of Computer Programming

History

Dr. Tolga PIRASACI (Gazi University)

Introduction

4 / 16

Introduction to Programming

Overview of FORTRAN Program

FORTRAN
Fortran (Formula Translating System) is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientic computing. Originally developed by IBM in the 1950s for scientic and engineering applications. Fortran came to dominate this area of programming early on and has been in continual use for over half a century in computationally intensive areas such as: numerical weather prediction, nite element analysis, computational uid dynamics, computational physics and chemistry. It was one of the most popular languages in the area of high-performance computing and is the language used for programs that benchmark and rank the worlds fastest supercomputers.
Dr. Tolga PIRASACI (Gazi University) Introduction 5 / 16

Introduction to Programming

Overview of FORTRAN Program

History

In late 1953, John W. Backus submitted a proposal to his superiors at IBM to develop a more practical alternative to ASSEMBLY language for programming their IBM 704 mainframe computer. A draft specication for The IBM Mathematical Formula Translating System was completed by mid-1954. The rst manual for FORTRAN appeared in October 1956, with the rst FORTRAN compiler delivered in April 1957. This was an optimizing compiler, because customers were reluctant to use a high-level programming language unless its compiler could generate code whose performance was comparable to that of hand-coded assembly language.

Dr. Tolga PIRASACI (Gazi University)

Introduction

6 / 16

Introduction to Programming

Overview of FORTRAN Program

History
The language was widely adopted by scientists for writing numerically intensive programs, which encouraged compiler writers to produce compilers that could generate faster and more ecient code. The inclusion of a complex number data type in the language made Fortran especially suited to technical applications such as electrical engineering. By 1960, versions of FORTRAN were available for the IBM 709, 650, 1620, and 7090 computers. Signicantly, the increasing popularity of FORTRAN spurred competing computer manufacturers to provide FORTRAN compilers for their machines, so that by 1963 over 40 FORTRAN compilers existed. For these reasons, FORTRAN is considered to be the rst widely used programming language supported across a variety of computer architectures.

Dr. Tolga PIRASACI (Gazi University)

Introduction

7 / 16

Introduction to Programming

Overview of FORTRAN Program

FORTRAN Versions

Fortran 0 Fortran I Fortran II Fortran III Fortran IV Fortran 77 Fortran 90 Fortran 95 Fortran 2003 Fortran 2008

Dr. Tolga PIRASACI (Gazi University)

Introduction

8 / 16

Algorithmic Approach and Flowcharting

Algorithm

Algorithm is a step by step procedure to solve a problem.

Dr. Tolga PIRASACI (Gazi University)

Introduction

9 / 16

Algorithmic Approach and Flowcharting

Flowchart

Flowchart is the diagrammatic form of the algorithm.

Dr. Tolga PIRASACI (Gazi University)

Introduction

10 / 16

Algorithmic Approach and Flowcharting

Flowchart Symbols
Beginning or end of program Input data from le Input data from keyboard Computation or mathematical operation

Indicate a decision

Output to a le

Output to screen

Connection symbol:connect parts of a owchart


Dr. Tolga PIRASACI (Gazi University) Introduction 11 / 16

Examples

Example-1

Example-1

Write an algorithm and draw a owchart to add 10 numbers.

Dr. Tolga PIRASACI (Gazi University)

Introduction

12 / 16

Examples

Example-2

Example-2

Write an algorithm and draw a owchart to nd the average of N numbers.

Dr. Tolga PIRASACI (Gazi University)

Introduction

13 / 16

Examples

Example-3

Example-3

Write an algorithm and draw a owchart to compute the function F below for an unknown number of set of data. The last data record has the value 999 and denes the end of data. 2 x +1 x 0 x 0<x <1 F = x x 1

Dr. Tolga PIRASACI (Gazi University)

Introduction

14 / 16

Examples

Example-4

Example-4

Write an algorithm and draw a owchart to nd the smallest of N numbers.

Dr. Tolga PIRASACI (Gazi University)

Introduction

15 / 16

Examples

Example-5

Example-5

Input nine numbers one at time and locate each as an element of doubly subscripted variable Xij . Each subscript has the range from 1 to 3.

Dr. Tolga PIRASACI (Gazi University)

Introduction

16 / 16

You might also like