Professional Documents
Culture Documents
Bahasa Komputer
Bahasa Komputer
Fadhliani
Civil Engineering Department
Malikussaleh University of
Lhokseumawe
Kontrak Kuliah
Introduction to
Programming
Algoritma tahapan langkah penyelesaian masalah
Program realisasi algoritma dalam bahasa pemograman
Masalah: Ada banyak contoh masalah yg diselesaikan dengan
program komputer. Perusahaan telekomunikasi
mengumpulkan data konsumen pra bayar vs. BMKG
melakukan prakiraan cuaca.
The range of problems that you want to solve will therefore
strongly influence your choice of programming language.
FORTRAN FORmula TRANslation
.
FORmula TRANslation
Mudah digunakan dan tidak rumit
Bahasanya sesuai baik untuk
penyelesaian masalah numeris
ataupun bukan
Sebagaimana bahasa umumnya,
bahasa Fortran jg memiliki aturan
grammar dan spelling
STATEMENTS (Pernyataan)
Bahasa Pemograman berbentuk
statements:
Data description statements
Control structures
Data-processing statements
Input and output (I/O)
statements
EXAMPLE
PROGRAM ch0701
!
! This program reads in and prints out a name
!
IMPLICIT NONE
CHARACTER*20 :: First_Name
!
PRINT *,' Type in your first name.'
PRINT *,' up to 20 characters'
READ *,First_Name
PRINT *,First_Name
!
END PROGRAM ch0701
EXAMPLE 2
PROGRAM ch0702
!
! This program reads in three numbers and sums
! and averages them
!
IMPLICIT NONE
REAL :: N1,N2,N3,Average = 0.0, Total = 0.0
INTEGER :: N = 3
PRINT *,' Type in three numbers.'
PRINT *,' Separated by spaces or commas'
READ *,N1,N2,N3
Total= N1 + N2 + N3
Average=Total/N
PRINT *,'Total of numbers is ',Total
PRINT *,'Average of the numbers is ',Average
END PROGRAM ch0702
Good programming
guidelines
Use comments to clarify the purpose of both
sections of the program and the whole
program.
Choose meaningful names in your programs.
Use indentation to highlight the structure of
the program. Remember that the program
has to be read and understood by both
humans and a computer.
Use IMPLICIT NONE in all programs you write
to minimise errors.