if (条件) 文A
文B
if (条件) then
条件が真ならば実行
else
条件が偽ならば実行
endif
真でも偽でもこれ以下は実行する
10 read(*,*) a
if (条件) goto 10
a2 = a**2
integer total(12)
integer total(0:100)
integer total(12), month, date, sum
character*1 yorn
logical leap
data total/31,28,31,30,31,30,31,31,30,31,30,31/
write(*,*) 'input month and date'
read (*,*) month, date
write(*,*) 'leap year? y or n'
read (*,*) yorn
if (yorn .eq. 'y' .or. yorn .eq. 'Y') then
leap = .true.
else
leap = .false.
endif
if (leap) total(2) = 29
sum = 0
do m = 1, month-1
sum = sum + total(m)
enddo
sum = sum + date
stop
end