Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

DDD asked in 電腦與網際網路程式設計 · 2 decades ago

幫忙:內定函數的問題

Q1 Print Fix(Int(1.9))*SQR(Cint(3.5)) Ans: 2

怎麼算? 不好意思..一直弄不懂...

Q2 CINT的用法

1 Answer

Rating
  • 2 decades ago
    Favorite Answer

    Print Fix(Int(1.9))*SQR(Cint(3.5))

    Cint() 是將資料轉換成整數型態,小數點四捨六入,遇五迎雙。

    遇五迎雙 是 如果 取進位值是 5 ,會找最接近的雙數

    例 Cint(3.5) = 4

    Cint(4.5) = 4

    SQR() 是取平方根的函數,

    所以SQR(Cint(3.5))=2

    Int()傳回數值整數的部份,

    所以Int(1.9)=1 《負數取值規則為,將小數無條件進位 例 : int( -4.1) = -5 》

    Fix()無條件捨去小數

    所以 Fix(Int(1.9))=1

    Print Fix(Int(1.9))*SQR(Cint(3.5))=2

Still have questions? Get your answers by asking now.