资源描述
1、找出100-150之间和400-450之间能被9整除的数2、找出100-999之间的回文数3、找出水仙花数推荐精选4、输出“*”图形5、 输入n个数,找出大于平均值的数和最小数推荐精选6、 把一个数值型数组的相同数删除到只剩一个7、 形成一个5*5矩阵,对角线元素为“i”,其余为“j”program juzhenimplicit noneinteger I,Jinteger,parameter:size=5integer:a(size,size)forall(I=1:size,J=1:size,IJ) a(I,J)=jforall(I=1:size,J=1:size,I=J) a(I,J)=iforall(I=1:size,J=1:size,IJ) a(I,J)=jwrite(*,(5(5I5,/)astopend8、 将两个有序数组合并program shanchonginteger n,m,l,k,j,i推荐精选integer,allocatable:a(:)integer,allocatable:b(:)integer,allocatable:c(:)write(*,*) 输入数组A的数据个数read(*,*) nwrite(*,*) 输入数组B的数据个数read(*,*) ml=m+nallocate (a(n)allocate (b(m)allocate (c(l)write(*,*) 从小到大输入A的元素do i=1,n read(*,*) a(i)end dowrite(*,*) 从小到大输入B的元素do i=1,m read(*,*) b(i)end dodo i=1,n c(i)=a(i)end doi=1do while(im+1) do j=1,n-1 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+1end dowrite(*,*) 合并后的数组按顺序输出为do i=1,l write(*,*) c(i)end doEnd9、 输出一个6行的杨辉三角推荐精选 (注:可编辑下载,若有不当之处,请指正,谢谢!) 推荐精选
展开阅读全文