program main call pyramid(1) write(*,*) call pyramid(2) write(*,*) call pyramid(3) write(*,*) call pyramid(4) write(*,*) call pyramid(5) end subroutine pyramid(height) integer width, height, w w = (height - 1) width = w * 2 + 1 do i = 1, height call draw(' ', w - i + 1) call draw('*', i - 1) write(*, '(a$)') '*' call draw('*', i - 1) call draw(' ', w - i + 1) write(*,*) end do end subroutine draw(c, count) character c integer count do i=1, count write(*, '(a$)') c end do end