Home » FORTRAN PROGRAM

Category Archives: FORTRAN PROGRAM

FORTRAN PROGRAM TO FIND AREA OF SECTOR

SECTOR OF CIRCLEA sector is portion of a circle or disk enclosed by two radii and an arc. The formula to obtain area of sector is as follows.
Area of sector = (Θ/360°) πr2
Where Θ is the angle between two radii in degree. And r is the radius of the circle or disk. (more…)

FORTRAN PROGRAM TO FIND LENGTH OF ARC

An arc is the length of some portion of the circumference of a circle.The length of arc of a circle is the product of radius of circle and the angle made of by the arc. Here the angle should be radian. If the angle is in degree then it must be changed to radian. If the length of arc is denoted by S, radius of circle by r and angle made by arc with Θ. Then S = rΘ (more…)

FORTRAN PROGRAM TO ADD SUBTRACT MULTIPLY DIVIDE

FORTRAN PROGRAM FOR BASIC ARITHMETIC

This is the FORTRAN program to add subtract multiply divide two numbers. Inputs are take by READ functions. And outputs are displayed using PRINT function. a, b and c are three Real Number variables. Variables a and b are used to store inputs and variable c is used to store output. x is another variable which is used to perform diffent Arithmetic operations. When x is equal to 1 then addition is done when x is equal to 2 then subtraction is done and when x is 3 then multiplication is done and at last when x is 4 then division is done.

IMPLICIT NONE
! FORTRAN PROGRAM TO ADD SUBTRACT MULTIPLY DIVIDE
! DATE: 22-02-2015
REAL :: a, b, c, x
PRINT*, “ENTER THE FIRST NUMBER”
READ*, a
PRINT*, “FIRST NUMBER a:”, a
PRINT*, “ENTER THE SECOND NUMBER”
READ*, b
PRINT*, “SECOND NUMBER b:”, b
PRINT*, “PRESS 1 TO ADD THE NUMBERS”
PRINT*, “PRESS 2 SUBTRACT THE NUMBERS”
PRINT*, “PRESS 3 TO MULTIPLY THE NUMBERS”
PRINT*, “PRESS 4 TO DIVIDE THE NUMBERS”
PRINT*, “PRESS THE NUMBER”
READ*, x
IF (x==1) THEN
c = a+b
PRINT*, “THE SUM OF TWO NUMBERS IS”, c
END IF
IF (x==2) THEN
c = a-b
PRINT*, “THE SUBTRACTION OF TWO NUMBERS IS”, c
END IF
IF (x==3) THEN
c = a*b
PRINT*, “THE MULTIPLICATION OF THE TWO NUMBERS IS”, c
END IF
IF (x==4) THEN
c = a/b
PRINT*, “THE DIVISION OF TWO NUMBERS IS”, c
END IF
STOP
END

OUTPUT OF THE PROGRAM

ENTER THE FIRST NUMBER
8
FIRST NUMBER a: 8
ENTER THE SECOND NUMBER
5
SECOND NUMBER b: 5
PRESS 1 TO ADD THE NUMBERS
PRESS 2 SUBTRACT THE NUMBERS
PRESS 3 TO MULTIPLY THE NUMBERS
PRESS 4 TO DIVIDE THE NUMBERS
PRESS THE NUMBER
2
THE SUBTRACTION OF TWO NUMBERS IS 3

FORTRAN 90 PROGRAM TO MULTIPLY TWO MATRICES

PROGRAM MATMUL
IMPLICIT NONE
! FORTRAN PROGRAM TO MULTIPLY TWO MATRICES
! DATE: 11-03-2015
INTEGER :: max
! max DENOTES THE MAXIMUM SIZE OF EACH ARRAY.

PARAMETER (max = 5)

INTEGER :: a(max, max), b(max, max), c(max, max)
INTEGER :: i, j, k, m1, n1, m2, n2
PRINT*, “ENTER NUMBER OF ROWS OF FIRST MATRIX”
READ*, m1
PRINT*, “ENTER NUMBER OF COLUMNS OF FIRST MATRIX”
READ*, n1
PRINT*, “DIMENSION OF FIRST MATRIX: “,m1,” X”,n1
! Input is taken for first matrix
PRINT*, “ENTER ELEMENTS OF FIRST MATRIX”
DO i=1, m1, 1
            DO j=1, n1, 1
                        READ*, a(i, j)
            END DO
END DO
! Here each row will be printed vertically
PRINT*, “FIRST MATRIX IS AS FOLLOWS:”
DO i=1, m1, 1
            DO j=1, n1, 1
                        PRINT*, a(i, j)
            END DO
            PRINT*,””
END DO
PRINT*, “ENTER NUMBER OF ROWS OF SECOND MATRIX”
READ*, m2
PRINT*, “ENTER NUMBER OF COLUMNS OF SECOND MATRIX”
READ*, n2
PRINT*, “DIMENSION OF SECOND MATRIX: “,m2,” X”,n2
! Input is taken for second matrix
PRINT*, “ENTER ELEMENTS OF SECOND MATRIX”
DO i=1, m2, 1
            DO j=1, n2, 1
                        READ*, b(i, j)
            END DO
END DO
PRINT*, “SECOND MATRIX IS AS FOLLOWS:”
! Each row will be print vertically
DO i=1, m2, 1
            DO j=1, n2, 1
                        PRINT*, b(i, j)
            END DO
            PRINT*,””
END DO
! Checking whether multiplication is possible or not
! Multiplication of two matrices is possible if the
! number of columns of first matrix is equal to the
! number of rows of second matrix.
IF (n1 /= m2) THEN
            PRINT*, “MULTIPLICATION OF THE MATRICES IS NOT POSSIBLE”
ELSE
            DO i=1, m1, 1
                        DO j=1, n2, 1
                                    c(i, j) = 0
                                    DO k=1, m2, 1
                                                c(i, j) = a(i, k) * b(k, j) + c(i, j)
                                    END DO
                        END DO
            END DO
! Each row will be printed vertically
            PRINT*, “MULTIPLICATION OF THE TWO MATRICES IS AS:”
            DO i=1, m1, 1
                        DO J=1, n2, 1
                                    PRINT*, c(i, j)
                        END DO
                        PRINT*, “”
            END DO
END IF
STOP
END  

OUTPUT OF THE PROGRAM
ENTER NUMBER OF ROWS OF FIRST MATRIX
2
ENTER NUMBER OF COLUMNS OF FIRST MATRIX
2
DIMENSION OF FIRST MATRIX: 2 X 2
ENTER ELEMENTS OF FIRST MATRIX
1
2
3
4
FIRST MATRIX IS AS FOLLOWS:
1
2

3
4
ENTER NUMBER OF ROWS OF SECOND MATRIX
2
ENTER NUMBER OF COLUMNS OF SECOND MATRIX
2
DIMENSION OF SECOND MATRIX: 2 X 2
ENTER ELEMENTS OF SECOND MATRIX
5
6
7
8
SECOND MATRIX IS AS FOLLOWS:
5
6

7
8
MULTIPLICATION OF THE TWO MATRICES IS AS:
19
22

43

50

FORTRAN 90 PROGRAM FOR TEMPERATURE CONVERSION

PROGRAM TEMCOV
IMPLICIT NONE
! FORTRAN program for temperature conversion
! DATE: 10-03-2015
REAL :: c, f, k, r, de, n, re, ro, temp, x
! Variable c is used for Celsius scale

! Variable f is used for Fahrenheit scale

! Variable k is used for Kelvin scale
! Variable r is used for Rankine scale
! Variable de is used for Delisle
! Variable n is used for Newton scale
! Variable re is used for Reaumur scale
! Variable ro is used for Romer scale
! temp is a common input variable for temperature
PRINT*, “PRESS 1 TO CONVERT TEMPERATURE FROM CELSIUS INTO OTHER”
PRINT*,”PRESS 2 TO CONVERT TEMPERATURE FROM FAHRENHEIT INTO OTHERS”
PRINT*, “PRESS 3 TO CONVERT TEMPERATURE FROM KELVIN INTO OTHERS”
PRINT*, “PRESS 4 TO CONVERT TEMPERATURE FROM RANKINE INTO OTHERS”
PRINT*, “PRESS 5 TO CONVERT TEMPERATURE FROM DELISLE INTO OTHERS”
PRINT*, “PRESS 6 TO CONVERT TEMPERATURE FROM NEWTON INTO OTHERS”
PRINT*,”PRESS 7 TO CONVERT TEMPERATURE FROM REAUMUR INTO OTHERS”
PRINT*, “PRESS 8 TO CONVERT TEMPERATURE FROM ROMER INTO OTHERS”
PRINT*, “ENTER YOUR CHOICE”
READ*, x
! Program code for choice 1
IF (x == 1) THEN
            PRINT*, “TEMPERATURE CONVERSION FROM CENTIGRADE INTO OTHERS”
! Input is taken.
            PRINT*, “ENTER THE TEMPERATURE IN CENTIGRADE”
            READ*, temp
            PRINT*, “TEMPERATURE IN CENTIGRADE IS “,temp
! Formula for conversion of temperature from centigrade to fahrenheit is as:
! F = (9/5)*C + 32
! 9.0/5.0 = 1.8
            f = 1.8*temp + 32
            PRINT*, “TEMPERATURE IN FAHRENHEIT IS “,f
! Formula for conversion of temperature from centigrade to kelvin is as:
! K = C + 273.15
            k = temp + 273.15
            PRINT*, “TEMPERATURE IN KELVIN IS “,k
! Formula for conversion of temperature from centigrade to rankine is as:
! R = (C + 273.15) * 9/5
! 9.0/5.0 = 1.8
            r = (temp + 273.15) * 1.8
            PRINT*, “TEMPERATURE IN RANKINE IS “,r
! Formula for conversion of temperature from centigrade to delisle is as:
! De = (100 – C) * 3/2
! 3.0/2.0 = 1.5
            de = (100 – temp) * 1.5
            PRINT*, “TEMPERATURE IN DELISLE IS “,de
! Formula for conversion of temperature from centigrade to newton is as:
! N = C * 33/100
! 33.0/100.0 = 0.33
            n = temp * 0.33
            PRINT*, “TEMPERATURE IN NEWTON IS “,n
! Formula for conversion of temperature from centigrade to reaumur is as:
! Re = C * 4/5
! 4.0/5.0 = 0.8
            re = temp * 0.8
            PRINT*, “TEMPERATURE IN REAUMUR IS “,re
! Formula for conversion of temperature from centigrade to romer is as:
! Ro = C * 21/40 + 7.5
! 21.0/40.0 = 0.525
            ro = temp * 0.525 + 7.5
            PRINT*, “TEMPERATURE IN ROMER IS “,ro
! Program code for choice 2
ELSE IF (x == 2) THEN
            PRINT*, “TEMPERATURE CONVERSION FROM FAHRENHEIT INTO OTHERS”
! Input is taken.
            PRINT*, “ENTER THE TEMPERATURE IN FAHRENHEIT”
            READ*, temp
            PRINT*, “TEMPERATURE IN FAHRENHEIT IS “,temp
! Formula for conversion of temperature from fahrenheit to centigrade is as:
! C = 5/9*(F – 32)
! 5.0/9.0 = 0.5555556
            c = 0.5555556*(temp – 32)
            PRINT*, “TEMPERATURE IN CENTIGRADE IS “,c
! Formula for conversion of temperature from fahrenheit to kelvin is as:
! K = (F + 459.67) * 5/9
! 5.0/9.0 = 0.5555556
            k = (temp + 459.67) * 0.5555556
            PRINT*, “TEMPERATURE IN KELVIN IS “,k
! Formula for conversion of temperature from fahrenheit to rankine is as:
! R =  F + 459.67
            r = temp + 459.67
            PRINT*, “TEMPERATURE IN RANKINE IS “,r
! Formula for conversion of temperature from fahrenheit to delisle is as:
! De = (212 – F) * 5/6
! 5.0/6.0 = 0.8333333
            de = (212 – temp) * 0.8333333
            PRINT*, “TEMPERATURE IN DELISLE IS “,de
! Formula for conversion of temperature from fahrenheit to newton is as:
! N = (F – 32) * 11/60
! 11.0/60.0 = 0.1833333
            n = (temp – 32) * 0.1833333
            PRINT*, “TEMPERATURE IN NEWTON IS “,n
! Formula for conversion of temperature from fahrenheit to reaumur is as:
! Re = (F – 32) * 4/9
! 4.0/9.0 = 0.4444444
            re = (temp – 32) * 0.4444444
            PRINT*, “TEMPERATURE IN REAUMUR IS “,re
! Formula for conversion of temperature from fahrenheit to romer is as:
! Ro = (F – 32) * 7/24 + 7.5
! 7.0/24.0 = 0.2916666
            ro = (temp – 32) * 0.2916666 + 7.5
            PRINT*, “TEMPERATURE IN ROMER IS “,ro
! Program code for choice 3
ELSE IF (x == 3) THEN
PRINT*, “TEMPERATURE CONVERSION FROM KELVIN INTO OTHERS”
! Input is taken.
            PRINT*, “ENTER THE TEMPERATURE IN KELVINE”
            READ*, temp
            PRINT*, “TEMPERATURE IN KELVIN IS “,temp          
! Formula for conversion of temperature from kelvin to centigrade is as:
! C = K – 273.15
            c = temp – 273.15
            PRINT*, “TEMPERATURE IN CENTIGRADE IS “,c
! Formula for conversion of temperature from kelvin to fahrenheit is as:
! F = K * 9/5 – 459.67
! 9.0/5.0 = 1.8
            f = 1.8 * temp – 459.67
            PRINT*, “TEMPERATURE IN FAHRENHEIT IS “,f
! Formula for conversion of temperature from kelvin to rankine is as:
! R = K * 9/5
! 9.0/5.0 = 1.8
            r = temp * 1.8
            PRINT*, “TEMPERATURE IN RANKINE IS “,r
! Formula for conversion of temperature from kelvin to delisle is as:
! De = (373.15 – K) * 3/2
! 3.0/2.0 = 1.5
            de = (373.15 – temp) * 1.5
            PRINT*, “TEMPERATURE IN DELISLE IS “,de
! Formula for conversion of temperature from kelvin to newton is as:
! N = (K – 273.15) * 33/100
! 33.0/100.0 = 0.33
            n = (temp – 273.15) * 0.33
            PRINT*, “TEMPERATURE IN NEWTON IS “,n
! Formula for conversion of temperature from kelvin to reaumur is as:
! Re = (K – 273.15) * 4/5
! 4.0/5.0 = 0.8
            re = (temp – 273.15) * 0.8
            PRINT*, “TEMPERATURE IN REAUMUR IS “,re
! Formula for conversion of temperature from kelvin to romer is as:
! Ro = (K – 273.15) * 21/40 + 7.5
! 21.0/40.0 = 0.525
            ro = (temp – 273.15) * 0.525 + 7.5
            PRINT*, “TEMPERATURE IN ROMER IS “,ro
! Program code for choice 4
ELSE IF (x == 4) THEN
PRINT*, “TEMPERATURE CONVERSION FROM RANKINE INTO OTHERS”
! Input is taken.
            PRINT*, “ENTER THE TEMPERATURE IN RANKINE”
            READ*, temp
            PRINT*, “TEMPERATURE IN RANKINE IS “,temp      
! Formula for conversion of temperature from rankine to centigrade is as:
! C = (R – 491.67) * 5/9
! 5.0/9.0 = 0.5555556
            c = (temp – 491.67) * 0.5555556
            PRINT*, “TEMPERATURE IN CENTIGRADE IS “,c
! Formula for conversion of temperature from rankine to fahrenheit is as:
! F = R – 459.67
            f = temp – 459.67
            PRINT*, “TEMPERATURE IN FAHRENHEIT IS “,f
! Formula for conversion of temperature from rankine to kelvin is as:
! K = R * 5/9
! 5.0/9.0 = 0.5555556
            k = temp * 0.5555556
            PRINT*, “TEMPERATURE IN KELVINE IS “,k
! Formula for conversion of temperature from rankine to delisle is as:
! De = (671.67 – R) * 5/6
! 5.0/6.0 = 0.83333333
            de = (671.67 – temp) * 0.83333333
            PRINT*, “TEMPERATURE IN DELISLE IS “,de
! Formula for conversion of temperature from rankine to newton is as:
! N = (R – 491.67) * 11/60
! 11.0/60.0 = 0.1833333
            n = (temp – 491.67) * 0.1833333
            PRINT*, “TEMPERATURE IN NEWTON IS “,n
! Formula for conversion of temperature from rankine to reaumur is as:
! Re = (R – 491.67) * 4/9
! 4.0/9.0 = 0.4444444
            re = (temp – 491.67) * 0.4444444
            PRINT*, “TEMPERATURE IN REAUMUR IS “,re
! Formula for conversion of temperature from rankine to romer is as:
! Ro = (R – 491.67) * 7/24 + 7.5
! 7.0/24.0 = 0.2916667
            ro = (temp – 491.67) * 0.2916667 + 7.5
            PRINT*, “TEMPERATURE IN ROMER IS “,ro
! Program code for choice 5
ELSE IF (x == 5) THEN
PRINT*, “TEMPERATURE CONVERSION FROM DELISLE INTO OTHERS”
! Input is taken.
            PRINT*, “ENTER THE TEMPERATURE IN DELISLE”
            READ*, temp
            PRINT*, “TEMPERATURE IN DELISLE IS “,temp        
! Formula for conversion of temperature from delisle to centigrade is as:
! C = 100 – De * 2/3
! 2.0/3.0 = 0.6666667
            c = 100 – temp * 0.6666667
            PRINT*, “TEMPERATURE IN CENTIGRADE IS “,c
! Formula for conversion of temperature from delisle to fahrenheit is as:
! F = 212 – De * 6/5
! 6.0/5.0 = 1.2
            f = 212 – temp * 1.2
            PRINT*, “TEMPERATURE IN FAHRENHEIT IS “,f
! Formula for conversion of temperature from delisle to kelvin is as:
! K = 373.15 – De * 2/3
! 2.0/3.0 = 0.6666667
            k = 373.15 – temp * 0.6666667
            PRINT*, “TEMPERATURE IN KELVIN IS “,k
! Formula for conversion of temperature from delisle to rankine is as:
! R = (671.67 – de) * 5/6
! 5.0/6.0 = 0.83333333
            r = (671.67 – temp) * 0.83333333
            PRINT*, “TEMPERATURE IN RANKINE IS “,r
! Formula for conversion of temperature from delisle to newton is as:
! N = 33 – De * 11/50
! 11.0/50.0 = 0.22
            n = 33 – temp * 0.22
            PRINT*, “TEMPERATURE IN NEWTON IS “,n
! Formula for conversion of temperature from delisle to reaumur is as:
! Re = 80 – De * 8/15
! 8.0/15.0 = 0.5333333
            re = 80 – temp * 0.5333333
            PRINT*, “TEMPERATURE IN REAUMUR IS “,re
! Formula for conversion of temperature from delisle to romer is as:
! Ro = 60 – De * 7/20
! 7.0/20.0 = 0.35
            ro = 60 – temp * 0.35
            PRINT*, “TEMPERATURE IN ROMER IS “,ro
! Program code for choice 6
ELSE IF (x == 6) THEN
PRINT*, “TEMPERATURE CONVERSION FROM NEWTON INTO OTHERS”
! Input is taken.
            PRINT*, “ENTER THE TEMPERATURE IN NEWTON”
            READ*, temp
            PRINT*, “TEMPERATURE IN NEWTON IS “,temp       
! Formula for conversion of temperature from newton to centigrade is as:
! C = N * 100/33
! 100.0/33.0 = 3.0303030
            c = temp * 3.0303030
            PRINT*, “TEMPERATURE IN CENTIGRADE IS “,c
! Formula for conversion of temperature from newton to fahrenheit is as:
! F = N * 60/11 + 32
! 60.0/11.0 = 5.4545454
            f = temp * 5.4545454 + 32
            PRINT*, “TEMPERATURE IN FAHRENHEIT IS “,f
! Formula for conversion of temperature from newton to kelvin is as:
! K = N * 100/33 + 273.15
! 100.0/33.0 = 3.0303030
            k = temp * 3.0303030 + 273.15
            PRINT*, “TEMPERATURE IN KELVIN IS “,k
! Formula for conversion of temperature from newton to rankine is as:
! R = N * 60/11 + 491.67
! 60.0/11.0 = 5.4545454
            r = temp * 5.4545454 + 491.67
            PRINT*, “TEMPERATURE IN RANKINE IS “,r
! Formula for conversion of temperature from newton to delisle is as:
! De = (33 – N) * 50/11
! 50.0/11.0 = 4.5454545
            de = (33 – temp) * 4.5454545
            PRINT*, “TEMPERATURE IN DELISLE IS “,de
! Formula for conversion of temperature from newton to reaumur is as:
! Re = N * 80/33
! 80.0/33.0 = 2.4242424
            re = temp * 2.4242424
            PRINT*, “TEMPERATURE IN REAUMUR IS “,re
! Formula for conversion of temperature from newton to romer is as:
! Ro = N * 35/22 + 7.5
! 35.0/22.0 = 1.5909091
            ro = temp * 1.5909091 + 7.5
            PRINT*, “TEMPERATURE IN ROMER IS “,ro
! Program code for choice 7
ELSE IF (x == 7) THEN
PRINT*, “TEMPERATURE CONVERSION FROM REAUMUR INTO OTHERS”
! Input is taken.
            PRINT*, “ENTER THE TEMPERATURE IN REAUMUR”
            READ*, temp
            PRINT*, “TEMPERATURE IN REAUMUR IS “,temp    
! Formula for conversion of temperature from reaumur to centigrade is as:
! C = Re * 5/4
! 5.0/4.0 = 1.25
            c = temp * 1.25
            PRINT*, “TEMPERATURE IN CENTIGRADE IS “,c
! Formula for conversion of temperature from reaumur to fahrenheit is as:
! F = Re * 9/4 + 32
! 9.0/4.0 = 2.25
            f = temp * 2.25 + 32
            PRINT*, “TEMPERATURE IN FAHRENHEIT IS “,f
! Formula for conversion of temperature from reaumur to kelvin is as:
! K = Re * 5/4 + 273.15
! 5.0/4.0 = 1.25
            k = temp * 1.25 + 273.15
            PRINT*, “TEMPERATURE IN KELVIN IS “,k
! Formula for conversion of temperature from reaumur to rankine is as:
! R = Re * 9/4 + 491.67
! 9.0/4.0 = 2.25
            r = temp * 2.25 + 491.67
            PRINT*, “TEMPERATURE IN RANKINE IS “,r
! Formula for conversion of temperature from reaumur to delisle is as:
! De = (80 – Re) * 15/8
! 15.0/8.0 = 1.875
            de = (80 – temp) * 1.875
            PRINT*, “TEMPERATURE IN DELISLE IS “,de
! Formula for conversion of temperature from reaumur to newton is as:
! N = Re * 33/80
! 33.0/80.0 = 0.4125
            n = temp * 0.4125
            PRINT*, “TEMPERATURE IN NEWTON IS “,n
! Formula for conversion of temperature from reaumur to romer is as:
! Ro = Re * 21/32 + 7.5
! 21.0/32.0 = 0.65625
            ro = temp * 0.65625 + 7.5
            PRINT*, “TEMPERATURE IN ROMER IS “,ro
! Program code for choice 8
ELSE IF (x == 8) THEN
PRINT*, “TEMPERATURE CONVERSION FROM ROMER INTO OTHERS”
! Input is taken.
            PRINT*, “ENTER THE TEMPERATURE IN ROMER”
            READ*, temp
            PRINT*, “TEMPERATURE IN ROMER IS “,temp         
! Formula for conversion of temperature from romer to centigrade is as:
! C = (Ro – 7.5) * 40/21
! 40.0/21.0 = 1.9047619
            c = (temp – 7.5) * 1.9047619
            PRINT*, “TEMPERATURE IN CENTIGRADE IS “,c
! Formula for conversion of temperature from romer to fahrenheit is as:
! F = (Ro – 7.5) * 24/7 + 32
! 24.0/7.0 = 3.4285714
            f = (temp – 7.5) * 3.4285714 + 32
            PRINT*, “TEMPERATURE IN FAHRENHEIT IS “,f
! Formula for conversion of temperature from romer to kelvin is as:
! K = (Ro – 7.5) * 40/21 + 273.15
! 40.0/21.0 = 1.9047619
            k = (temp – 7.5) * 1.9047619 + 273.15
            PRINT*, “TEMPERATURE IN KELVIN IS “,k
! Formula for conversion of temperature from romer to rankine is as:
! R = (Ro – 7.5) * 24/7 + 491.67
! 24.0/7.0 = 3.4285714
            r = (temp – 7.5) * 3.4285714 + 491.67
            PRINT*, “TEMPERATURE IN RANKINE IS “,r
! Formula for conversion of temperature from romer to delisle is as:
! De = (60 – Ro) * 20/7
! 20.0/7.0 = 2.8571428
            de = (60 – temp) * 2.8571428
            PRINT*, “TEMPERATURE IN DELISLE IS “,de
! Formula for conversion of temperature from romer to newton is as:
! N = (Ro – 7.5) * 22/35
! 22.0/35.0 = 0.6285714
            n = (temp – 7.5) * 0.6285714
            PRINT*, “TEMPERATURE IN NEWTON IS “,n
! Formula for conversion of temperature from romer to reaumur is as:
! Re = (Ro – 7.5) * 32/21
! 32.0/21.0 = 1.5238095
            re = (temp – 7.5) * 1.5238095
            PRINT*, “TEMPERATURE IN REAUMUR IS “,re
END IF
STOP
END
OUTPUT OF THE PROGRAM
PRESS 1 TO CONVERT TEMPERATURE FROM CELSIUS INTO OTHER
PRESS 2 TO CONVERT TEMPERATURE FROM FAHRENHEIT INTO OTHERS
PRESS 3 TO CONVERT TEMPERATURE FROM KELVIN INTO OTHERS
PRESS 4 TO CONVERT TEMPERATURE FROM RANKINE INTO OTHERS
PRESS 5 TO CONVERT TEMPERATURE FROM DELISLE INTO OTHERS
PRESS 6 TO CONVERT TEMPERATURE FROM NEWTON INTO OTHERS
PRESS 7 TO CONVERT TEMPERATURE FROM REAUMUR INTO OTHERS
PRESS 8 TO CONVERT TEMPERATURE FROM ROMER INTO OTHERS
ENTER YOUR CHOICE
1
TEMPERATURE CONVERSION FROM CENTIGRADE INTO OTHERS
ENTER THE TEMPERATURE IN CENTIGRADE
100
TEMPERATURE IN CENTIGRADE IS 100.0000000
TEMPERATURE IN FAHRENHEIT IS 212.0000000
TEMPERATURE IN KELVIN IS 373.149994
TEMPERATURE IN RANKINE IS 671.669983
TEMPERATURE IN DELISLE IS 0.0000000
TEMPERATURE IN NEWTON IS 33.0000000
TEMPERATURE IN REAUMUR IS 80.0000000

TEMPERATURE IN ROMER IS 59.9999962

FORTRAN PROGRAM TO SOLVE A PAIR OF LINEAR EQUATION

IMPLICIT NONE
! FORTRAN PROGRAM TO SOLVE A PRIR OF LINEAR EQUATION
! DATE: 07-03-2015
REAL :: a1, b1, c1, a2, b2, c2, x, y
! The equation must be of the form ax + by = c.
PRINT*, “Enter the values of a1, b1 and c1”

READ*, a1, b1, c1

PRINT*, “Values of a1, b1 and c1 are as follows:”
PRINT*, “a1:”,a1,”, b1:”,b1,”, c1:”,c1
PRINT*, “Enter the values of a2, b2 and c2”
READ*, a2, b2, c2
PRINT*, “Values of a2, b2 and c2 are as follows:”
PRINT*, “a2:”,a2,”, b2:”,b2,”, c2:”,c2
PRINT*, “THE EQUATIONS ARE AS FOLLOWS:”
PRINT*, a1,”x + “,b1,”y = “,c1
PRINT*, a2,”x + “,b2,”y = “,c2
IF (a1*b2 – a2*b1 == 0) THEN
            PRINT*, “EQUATIONS HAVE NO SOLUTION”
ELSE
            x = (b2*c1 – b1*c2)/(a1*b2 – a2*b1)
            y = (c2*a1 – c1*a2)/(a1*b2 – a2*b1)
            PRINT*, “THE SOLUTION ARE AS FOLLOWS:”
            PRINT*, “x: “, x
            PRINT*, “y: “, y
END IF
STOP
END

OUTPUT OF THE PROGRAM
Enter the values of a1, b1 and c1
1
1
1
Values of a1, b1 and c1 are as follows:
a1: 1.0000000, b1: 1.0000000, c1: 1.0000000
Enter the values of a2, b2 and c2
1
-1
1
Values of a2, b2 and c2 are as follows:
a2: 1.0000000, b2: -1.0000000,  c1: 1.0000000
THE EQUATIONS ARE AS FOLLOWS:
1x + (1)y = 1
1x + (-1)y = 1
THE SOLUTIONS ARE AS FOLLOWS:
x: 1.0000000

y: 0.0000000

FORTRAN 90 PROGRAM TO SOLVE A QUADRATIC EQUATION

PROGRAM QROOTS
IMPLICIT NONE
! FORTRAN PROGRAM TO SOLVE A QUADRATIC EQUATION
! DATE: 05-03-2015
INTEGER :: a, b, c
REAL :: d, droot, root1, root2

! root1 and root2 are the two roots of the equation

! d is used to calculate discriminant of the equation
! d = b*b – 4*a*c
PRINT*, “ENTER VALUE OF a”
READ*, a
PRINT*, “a: “, a
PRINT*, “ENTER VALUE OF b”
READ*, b
PRINT*, “b: “, b
PRINT*, “ENTER VALUE OF c”
READ*, c
PRINT*, “c: “, c
! Calculation of discriminant.
d = b*b – 4*a*c
IF (a==0) THEN
            PRINT*, “ROOTS NOT POSSIBLE”
ELSE
            PRINT*, “THE EQUATION IS AS:”
            PRINT*, a,”X**2 + “,b,”x + “,c
            IF (d>0) THEN
! If discriminant is greater than 0 then roots will be real
! and unequal.
                        droot = SQRT(d)
                        root1 = (-b + droot)/(2*a)
                        root2 = (-b – droot)/(2*a)
                        PRINT*, “ROOTS OF THE EQUATION ARE AS FOLLOWS:”
                        PRINT*, “ROOT1: “, root1
                        PRINT*, “ROOT2: “, root2
            ELSE IF (d==0) THEN
! If discriminant is 0 then roots will be real and equal.
                        root1 = -b/(2*a)
                        root2 = -b/(2*a)
                        PRINT*, “ROOTS OF THE EQUATION ARE AS FOLLOWS:”
                        PRINT*, “ROOT1: “, root1
                        PRINT*, “ROOT2: “, root2
            ELSE
! If discriminant is less than 0 then real roots not possible.
            PRINT*, “ROOTS OF THE EQUATION ARE COMPLEX.”
            END IF
END IF
STOP
END  

OUTPUT OF THE PROGRAM
ENTER VALUE OF a
1
a: 1
ENTER VALUE OF b
5
b: 5
ENTER VALUE OF c
6
c: 6
THE EQUATION IS AS:
1X**2 + 5X + 6
ROOTS OF THE EQUATION ARE AS FOLLOWS:
ROOT1: – 3
ROOT2: – 2