Visual Basic Powering a Number

You can use the Pow() method of the Math class to get the specified power of a number in the Visual Basic programming language.

This method takes 2 parameters. The first parameter is the number itself (base), and the second parameter is the force to be taken (power).

Parameters are of type double. Likewise, the method returns a value of type double.

Let's examine the example below..

Module ModuleTest Sub Main() Dim num1 As Double = 5 Dim num2 As Double = 3 Dim pow As Double = Math.Pow(num1, num2) Console.WriteLine(pow) Console.ReadLine() End Sub End Module

In the example, the number 5 to the 3rd power is taken. The result will return 125.



You May Interest

How to Find the Name of the Operating System in Visual Basic ?

Visual Basic Randomly Shuffle a List

Visual Basic Finding the Computer Name

Visual Basic Generating Random Letters

Visual Basic String Making Lowercase