codeblocks 环境下fortran编程实现最大值的方法

来源:网络时间:2015-12-17 15:03:16

  fortran编程实现求最大值

  源代码如下:

  implicit none

  integer::i,j,N

  real*8::x(8)

  real*8::tmp

  x=[12,39,499,20,3,1999,888,8]

  N=size(x)

  tmp=x(1)

  do i=1,N

  if(x(i)>tmp)then

  tmp=x(i)

  end if

  end do

  print *, "最大值为:",tmp

codeblocks 环境下fortran编程实现最大值的方法

  编译、运行,结果如下:

codeblocks 环境下fortran编程实现最大值的方法
文章内容来源于网络,不代表本站立场,若侵犯到您的权益,可联系我们删除。(本站为非盈利性质网站) 联系邮箱:rjfawu@163.com