Author: admin
-
Arrays
Arrays can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. All arrays consist of contiguous memory locations. The lowest address corresponds to…
-
Strings
The Fortran language can treat characters as single character or contiguous strings. A character string may be only one character in length, or it could even be of zero length. In Fortran, character constants are given between a pair of double or single quotes. The intrinsic data type character stores characters and strings. The length of the…
-
Characters
The Fortran language can treat characters as single character or contiguous strings. Characters could be any symbol taken from the basic character set, i.e., from the letters, the decimal digits, the underscore, and 21 special characters. A character constant is a fixed valued character string. The intrinsic data type character stores characters and strings. The length of…
-
Loops
There may be a situation, when you need to execute a block of code several number of times. In general, statements are executed sequentially : The first statement in a function is executed first, followed by the second, and so on. Programming languages provide various control structures that allow for more complicated execution paths. A…
-
Decisions
Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed, if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Following is the…
-
Operators
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. Fortran provides the following types of operators − Let us look at all these types of operators one by one. Arithmetic Operators Following table shows all the arithmetic operators supported by Fortran. Assume variable A holds 5 and variable B holds 3 then…
-
Constants
The constants refer to the fixed values that the program cannot alter during its execution. These fixed values are also called literals. Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, a complex constant, or a string literal. There are only two logical constants : .true. and .false.…
-
Variables
A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable should have a specific type, which determines the size and layout of the variable’s memory; the range of values that can be stored within that memory; and the set of operations that can be applied to…
-
Data Types
Fortran provides five intrinsic data types, however, you can derive your own data types as well. The five intrinsic types are − Integer Type The integer types can hold only integer values. The following example extracts the largest value that can be held in a usual four byte integer − Live Demo program testingInt implicit…
-
Basic Syntax
A Fortran program is made of a collection of program units like a main program, modules, and external subprograms or procedures. Each program contains one main program and may or may not contain other program units. The syntax of the main program is as follows − program program_name implicit none ! type declaration statements !…