close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決 
50% off Print Subscription of USA Today

Get the news delivered to your doorstep. Lock in the savings and receive USA Today for just $0.75 a day.
From our sponsors
有關FORTRAN的DO迴圈
Apr 8th 2014, 14:48

program factor_N
    implicit none            ! 加上這個,養成好習慣。
    integer :: N=20.0, i=0   ! 既然 N 是整數,你給他 20.0 是想怎樣?還有那個 i 在這給初值有點多餘。

    do i=1, 20, 1            ! 你剛剛初始化 i 為零,所以 i 將從零跑到 20。
        if(mod(n,i)==0) then ! 你告訴我 N 除上零會有什麼狀況?
            write(*,*) i
        endif                ! 雖然說 endif 和 enddo 這樣的寫法好像也可以,但對於一些比較龜毛的編譯器,
    enddo                    ! 您還是需要加空白把他分開變成 end if 和 end do,才能編譯通過。

end
! 把上面我寫的那些問題處理掉以後,你的程式應該就會跑出正確結果了。

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 granaxky 的頭像
    granaxky

    2016大台北美食推薦懶人包【食記】台北車站 | 微風美食廣場-夢卡朵/咖哩飯【台北餐廳】人氣拉麵~花月嵐拉麵台北車站台北平價餐廳美食總整理

    granaxky 發表在 痞客邦 留言(0) 人氣()