ADVERTISEMENT
ADVERTISEMENT

VB.Net program to get the smallest value using Math.Min() method

Here, we are going to learn how to get the smallest value using Math.Min() method in VB.Net?
Submitted by Nidhi, on December 02, 2020

Here, we will get the smallest value from two numbers using Math.Min() method and then print the smallest value on the console screen.

Program/Source Code:

The source code to get the smallest value using Math.Min() method is given below. The given program is compiled and executed successfully.

'VB.Net program to get small value using 
'Min() method.

Module Module1

    Sub Main()
        Dim num1 As Decimal = 3.26
        Dim num2 As Decimal = 4.28
        Dim small As Decimal = 0

        small = Math.Min(num1, num2)

        Console.WriteLine("Small value: {0}", small)

    End Sub
End Module

Output:

Small value: 3.26
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains the Main() method. In the Main() method we created two local variables num1, num2 that are initialized with 3.26 and 4.28 respectively.

small = Math.Min(num1, num2)

Console.WriteLine("Small value: {0}", small)

Here, we used the Min() method of Math class. Here, we got the small value from variable num1 and num2 and assigned to variable small. After that, we printed the value small 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.