program aa character (len=50) :: a, b, c, d, e integer :: i, j a = "aaa bbbb ccccc dddddd eeeeeee" print *, a i = index(a," ")+1 b = a(:i-2) print *, b c = a(i:) print *, c j = index (c," ") +1 d = c(:j-2) print *, d e = d(j:) print *, e end program aa program 0206 ! Asks the hour and the minute values of the ! present time and displays it as a sentence. integer :: hh,mm print *, " Input the hour, in the 24 hours format." read *, hh print *, " Input the minute." read *, mm print *, "" print *, " THE TIME IS ",mm," MINUTES AFTER ",hh end program 0206 ! Assignment statements with constant expressions. program C01 implicit none integer, parameter :: NAME_LENGTH = 21 real :: Avogadros_Number integer :: Many complex :: Z logical :: Flag character (len = NAME_LENGTH) :: Name ! start program C01 Many = 346021 ! Integer type Avogadros_Number = 6.0221367e23 ! Real type Z = (0.0, 1.75e8) ! Complex type Flag = .true. Name = " Mustafa Sezer" ! Character type, length 21 write (unit = *, fmt = *) Many, Avogadros_Number, Z, Flag, Name stop end program C01 program C02 use C02M implicit none ! start program C02 call Assign_2( ) stop end program C02 ! Assignment statements with variable expressions. module C02M implicit none public :: Assign_2 contains subroutine Assign_2( ) ! Type declarations with initialization: real, save :: Y = 1.23, Pi = 3.141592 integer, save :: Counts = 173 character (len = 8), save :: I = " Optics " logical, save :: Flag = .true. ! Type declarations without initialization: real :: X, Theta integer :: Many character (len = 8) :: K logical :: Done ! start subroutine Assign_2 X = Y ! Real type Y = X Theta = Pi Many = Counts ! Integer type K = I ! Character type, length 8 Done = Flag ! Logical type write (unit = *, fmt = *) Y, Pi, X, Theta, Counts, Many, I, K, Flag, Done return end subroutine Assign_2 end module C02M ! Assignment statements with arithmetic expressions. program C03 implicit none real, parameter :: GRAVITY = 9.8 real :: Old_Vol, Old_Press, Old_Temp, New_Vol, New_Press, New_Temp real :: Mass, Velocity, Kinetic_Energy, Pressure, Density, Height, Bernoulli integer, parameter :: J = 6 integer :: I ! start program C03 I = J + 1 write (unit = *, fmt = *) I read (unit = *, fmt = *) Old_Vol, Old_Press, Old_Temp, New_Press, New_Temp New_Vol = Old_Vol * (Old_Press / New_Press) * (New_Temp / Old_Temp) write (unit = *, fmt = *) Old_Vol, Old_Press, Old_Temp, New_Vol, New_Press, New_Temp read (unit = *, fmt = *) Mass, Velocity Kinetic_Energy = 0.5 * Mass * Velocity ** 2 write (unit = *, fmt = *) Mass, Velocity, Kinetic_Energy read (unit = *, fmt = *) Pressure, Density, Velocity, Height Bernoulli = Pressure + Density * (0.5 * Velocity ** 2 + GRAVITY * Height) write (unit = *, fmt = *) Pressure, Density, Velocity, Height, Bernoulli stop end program C03