[問題] loop的用法

看板Fortran作者 (下巴翰)時間14年前 (2011/01/01 22:51), 編輯推噓2(202)
留言4則, 3人參與, 最新討論串1/1
小弟這學期剛學fortran program Fibonacci implicit none integer :: fn0, fn1, fn, count, number, loop print *, "Which Fabonacci number you what to find?" read *, number !The number is the nth Fabonacci nuber that need to find. Note that 0 is the zeroth termbut not the first. fn0 = 0 fn1 = 1 if ( number > 46) then number = 46 print *, "" print *, "The 47th number and onwards are too big for the computer to calculate. Only 46 terms will be displayed." end if loop = number - 1 print *, "" print *, "The numbers are:" loop0 : do print *, "0", fn0 if ( number == 0 ) stop loop1 : do print *, "1", fn1 if ( number == 1 ) stop loopfn : do count = 1, loop fn = fn0 + fn1 print *, (count + 1), "", fn fn0 = fn1 fn1 = fn end do loopfn exit loop0 end do loop1 end do loop0 stop end program Fibonacci 費式數列從WIKI上找到的是這樣 想問一下(loop0 : do)<===這用法是怎樣 有專業人士解說給小弟聽嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.91.81.203

01/01 23:25, , 1F
替迴圈取名loop0
01/01 23:25, 1F

01/02 13:06, , 2F
為何wiki寫的這麼複雜....
01/02 13:06, 2F

01/03 14:44, , 3F
當初 wiki 費氏數列的Fortran程式是我寫的 但是不知道是
01/03 14:44, 3F

01/03 14:45, , 4F
誰改成這樣......
01/03 14:45, 4F
文章代碼(AID): #1D7pzugg (Fortran)
文章代碼(AID): #1D7pzugg (Fortran)