program main
implicit none
integer a, b ! for input values
integer c, d, e, f ! for calculated results
real g, h ! for calculated results
!——————————————————
! input values
!——————————————————
a = 2
b = 3
!——————————————————
! different mathematical operation
!——————————————————
c = a + b ! addition
d = a * b ! multiplication
e = a / b ! division
f = a**2 + b**(3/2) ! exponent
!——————————————————
! printing results
!——————————————————
print 100, “c = “, c, “d =”, d, “e =”, e, “f =”, f
100 format(4(a,i3,5x))
!——————————————————
! effect of integer and real type
!——————————————————
g = real(a) / real(b) ! same as in “e” above but now g is a real type variable
h = real(a)**2.0 + real(b)**(3.0/2.0) ! same as in “f” above but now g is a real type variable
print 101, “g =”, g, “h =”, h
101 format(2(a,f6.3,5x))
end