當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET Math.Pow方法代碼示例

本文整理匯總了VB.NET中System.Math.Pow方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Math.Pow方法的具體用法?VB.NET Math.Pow怎麽用?VB.NET Math.Pow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Math的用法示例。


在下文中一共展示了Math.Pow方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: Example

Public Module Example
   Public Sub Main
      Dim value As Integer = 2
      For power As Integer = 0 To 32
         Console.WriteLine("{0}^{1} = {2:N0} (0x{2:X})", _
                           value, power, CLng(Math.Pow(value, power)))
      Next
   End Sub
End Module
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:9,代碼來源:Math.Pow

輸出:

2^0 = 1 (0x1)
2^1 = 2 (0x2)
2^2 = 4 (0x4)
2^3 = 8 (0x8)
2^4 = 16 (0x10)
2^5 = 32 (0x20)
2^6 = 64 (0x40)
2^7 = 128 (0x80)
2^8 = 256 (0x100)
2^9 = 512 (0x200)
2^10 = 1,024 (0x400)
2^11 = 2,048 (0x800)
2^12 = 4,096 (0x1000)
2^13 = 8,192 (0x2000)
2^14 = 16,384 (0x4000)
2^15 = 32,768 (0x8000)
2^16 = 65,536 (0x10000)
2^17 = 131,072 (0x20000)
2^18 = 262,144 (0x40000)
2^19 = 524,288 (0x80000)
2^20 = 1,048,576 (0x100000)
2^21 = 2,097,152 (0x200000)
2^22 = 4,194,304 (0x400000)
2^23 = 8,388,608 (0x800000)
2^24 = 16,777,216 (0x1000000)
2^25 = 33,554,432 (0x2000000)
2^26 = 67,108,864 (0x4000000)
2^27 = 134,217,728 (0x8000000)
2^28 = 268,435,456 (0x10000000)
2^29 = 536,870,912 (0x20000000)
2^30 = 1,073,741,824 (0x40000000)
2^31 = 2,147,483,648 (0x80000000)
2^32 = 4,294,967,296 (0x100000000)

示例2: Module1

' 導入命名空間
Imports System.IO

Module Module1

    Sub Main()
        Console.WriteLine("Absolute value of -1 is " & Math.Abs(-1))
        Console.WriteLine("Square Root of 144 is " & Math.Sqrt(144))
        Console.WriteLine("Value for PI is " & Math.PI)
        Console.WriteLine("10 raised to the power of 2 is " & Math.Pow(10, 2))
        
    End Sub

End Module
開發者ID:VB程序員,項目名稱:System,代碼行數:14,代碼來源:Math.Pow


注:本文中的System.Math.Pow方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。