program calendar implicit none integer(8) a,b,c,i,y y=0 do i=1,6 if (i==2) then call twentyeight(b,y) else if (mod(i,2)==0) then call thirty(c,i,y) else call thirtyone(a,i,y) end if end do do i=7,12 if (i==9) then call thirty(c,i,y) else if (i==11) then call thirty(c,i,y) else call thirtyone(a,i,y) end if end do write(*,*) y end program calendar subroutine twentyeight(b,y) integer(8) i,x,b,y b=28 do i=1,b x=int(i/10)+mod(i,10) if (x==2) then y=y+1 end if end do end subroutine twentyeight subroutine thirty(c,i,y) integer(8) j,x,c,y,i c=30 do j=1,c x=int(j/10)+mod(j,10) if (x==i) then y=y+1 end if end do end subroutine subroutine thirtyone(a,i,y) integer(8) j,x,a,y,i a=31 do j=1,a x=int(j/10)+mod(j,10) if (x==i) then y=y+1 end if end do end subroutine