ADVERTISEMENT
ADVERTISEMENT

VB.Net program to find the logarithm value of a specified number

Here, we are going to learn how to find the logarithm value of a specified number in VB.Net?
Submitted by Nidhi, on December 02, 2020

Here, we will find the logarithm value of a specified number using the Log() method of Math class.

Program/Source Code:

The source code to find the logarithm value of a specified number is given below. The given program is compiled and executed successfully.

'VB.Net program to find logarithm value 
'of a specified number.

Module Module1

    Sub Main()
        'Find log value with base e
        Console.WriteLine("Logarithm value with Base E")
        Console.WriteLine(Math.Log(3))
        Console.WriteLine(Math.Log(2.34))
        Console.WriteLine(Math.Log(-2.56))

        'Find log value with specified base.
        Console.WriteLine("Logarithm value with specified Base")
        Console.WriteLine(Math.Log(3, 1))
        Console.WriteLine(Math.Log(2.34, 2))
        Console.WriteLine(Math.Log(-2.56, 4))
    End Sub
    
End Module

Output:

Logarithm value with Base E
1.09861228866811
0.85015092936961
NaN
Logarithm value with specified Base
NaN
1.22650852980868
NaN
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains a method Main(). In the Main() method, we called the Log() method with different specified numbers.

'Find log value with base e
Console.WriteLine("Logarithm value with Base E")
Console.WriteLine(Math.Log(3))
Console.WriteLine(Math.Log(2.34))
Console.WriteLine(Math.Log(-2.56))

Here, we find the log value with base e and print the result on the console screen.

'Find log value with a specified base.
Console.WriteLine("Logarithm value with specified Base")
Console.WriteLine(Math.Log(3, 1))
Console.WriteLine(Math.Log(2.34, 2))
Console.WriteLine(Math.Log(-2.56, 4))

Here, we find the log value with a specified base and print the result on the console screen.

VB.Net Basic Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.