1、找出100-150之间和400-450之间能被9整除的数
2、找出100-999之间的回文数
3、找出水仙花数
4、输出“*”图形
5、输入n个数,找出大于平均值的数和最小数
6、把一个数值型数组的相同数删除到只剩一个
7、形成一个5*5矩阵,对角线元素为“i”,其余为“j”program juzhen
implicit none
integer I,J
integer,parameter::size=5
integer::a(size,size)
forall(I=1:size,J=1:size,I>J) a(I,J)=j
forall(I=1:size,J=1:size,I==J) a(I,J)=i
forall(I=1:size,J=1:size,I<J) a(I,J)=j
write(*,"(5(5I5,/))")a
stop
end
8、将两个有序数组合并
program shanchong
integer n,m,l,k,j,i
integer,allocatable::a(:)
integer,allocatable::b(:)
integer,allocatable::c(:)
write(*,*) "输入数组A的数据个数"
read(*,*) n
write(*,*) "输入数组B的数据个数"
read(*,*) m
l=m+n
allocate (a(n))
allocate (b(m))
allocate (c(l))
write(*,*) "从小到大输入A的元素"
do i=1,n
read(*,*) a(i)
end do
write(*,*) "从小到大输入B的元素"
do i=1,m
read(*,*) b(i)
end do
do i=1,n
c(i)=a(i)
end do
i=1
do while(i<m+1)
do j=1,n-1
if(b(i)<c(1))then
n=n+1
do k=n,2,-1
c(k)=c(k-1)
end do
c(1)=b(i)
goto 10
else if(b(i)>=c(n))then
n=n+1
c(n)=b(i)
goto 10
else if(b(i)>c(j).and.b(i)<c(j+1))then
n=n+1
do k=n,j+2,-1
c(k)=c(k-1)
end do
c(j+1)=b(i)
goto 10
else if(b(i)==c(j))then
n=n+1
do k=n,j+1,-1
c(k)=c(k-1)
end do
goto 10
end if
end do
10 i=i+1
end do
write(*,*) "合并后的数组按顺序输出为" do i=1,l
write(*,*) c(i)
end do
End
9、输出一个6行的杨辉三角。