Comp Lang Intro
Comp Lang Intro
Introduction
OCN-3205
(Computer Programming for Oceanographers)
Lecture 06 (updated_new)
OUTPUT:
Please type your full name? Sujit Kumar Debsarma
First name is Sujit
Middle name is Kumar
Last name is Debsarma
Fortran Language
FORTRAN was developed by a team of programmers at IBM led
by John Backus, and was first published in 1957. The name
FORTRAN is an acronym for FORmula TRANslation.
According to someone, BASIC is the child of FORTRAN.
Mathematical expressions and some structures are very much
similar. Oldest versions still in use are Fortran IV, and Fortran 66.
Most commonly used versions today are : Fortran77, Fortran90,
and Fortran95. It supports −
● Numerical analysis and scientific computation
● Structured programming
● Array programming
● Modular programming
● Generic programming
● High performance computing on supercomputers
● Object Oriented Programming (OOP)
● Concurrent programming
● Reasonable degree of portability between computer systems
First Fortran Program
Compiler Link:
https://www.tutorialspoint.com/compile_fortran_online.php
File name: hello.f95
NB: Fortran file name extension may be *.f or *.for in Fortran77,
*.f90, and *.f95 in Fortran90 and 95 respectively. Here '*' may be
any file name.
program hello
implicit none ! Implicit typing is a good practice in Fortran
! Some compiler takes both single and double quote strings.
print *, 'Hello, World!' ! print string ''Hello, World!'
end program hello
OUTPUT:
Hello, World!
C Language
❖ C is a general-purpose, high-level language that was
originally developed by Dennis M. Ritchie to develop the
UNIX operating system at Bell Labs, USA. C was
originally first implemented on the DEC PDP-11 computer
in 1972.
✔ Easy to learn
✔ Structured language
✔ It produces efficient programs
✔ It can handle low-level activities
✔ It can be compiled on a variety of computer platforms
First C Program
Compiler Link: https://www.tutorialspoint.com/compile_c_online.php
OUTPUT:
Hello, World!
Python Program
#! /usr/bin/python # PATH of python language
# Variable declaration
var1 = 'Hello World!'
# var1[:6] equals 'Hello '
print ("Updated String :- ", var1[:6] + 'Python')
OUTPUT:
●Updated String :- Hello Python
Last Words About Computer
Languages
➢ There are many other computer languages like Perl,
Pascal, etc., etc.
➢ But Fortran is the most suitable language for
mathematical/ numerical calculations and modeling.
➢ Hence, we will discuss and practice Fortran77,
Fortran90 and Fortran95.
➢ Fortran77 codes can run well with Fortran90/95
compiler (upward compatibility).
➢ Fortran90/95 is a very powerful high level language.
➢ If you learn one language well, you can learn other
languages yourself easily.
Conventional File name Extensions
File names may be Upper case, Lower case or mixed
cases with underscore (_) like HELLO.F, My_Prog.c
string.bas etc.
Sl. No. Computer languages File name Extensions
1 BASIC *.bas
2 Fortran 77 *.f or *.for
3 Fotran 90 *.f90
4 Fortran 95 *.f95
5 C / C++ *.c / *.cpp
6 Java *.java
7 Python *.py