ADVERTISEMENT
ADVERTISEMENT

VB.Net program to get a large value using Math.Max() method

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

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

Program/Source Code:

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

'VB.Net program to get large value using 
'Max() method.

Module Module1

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

        large = Math.Max(num1, num2)

        Console.WriteLine("Large value: {0}", large)
    End Sub

End Module

Output:

Large value: 4.28
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.

large = Math.Max(num1, num2)

Console.WriteLine("Large value: {0}", large)

In the above code, we used the Max() method of Math class. Here, we got the large value from variable num1 and num2 and assigned to variable large. After that, we printed the value large on the console screen.

VB.Net Basic Programs »



ADVERTISEMENT




ADVERTISEMENT



Comments and Discussions!

ADVERTISEMENT

ADVERTISEMENT

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.