fortran在屏幕上输出如下任意阶的金字塔形状。 * * * * * * * * * * * * * * * *
时间: 2024-05-12 07:11:24 浏览: 48
Fortran打印金字塔型星星:
```fortran
program pyramid
implicit none
integer :: n, i, j
write(*,*) '请输入想打印星星的层数'
read(*,*) n
do i = 1, n
do j = 1, n-i
write(*,'(A1)',advance="no") " "
end do
do j = 1, 2*i-1
write(*,'(A1)',advance="no") "*"
end do
write(*,*)
end do
end program pyramid
```
阅读全文