VB.Net Program to Demonstrate the CDbl() Function

You are currently viewing VB.Net Program to Demonstrate the CDbl() Function

VB.Net program to demonstrate the CDbl() function

'VB.Net program to demonstrate the CDbl() function.

Module Module1

    Sub Main()
        Dim num As Double = 0

        Dim n1 As Single = 10.25
        Dim n2 As Integer = 12
        Dim n3 As Decimal = 25.35
        Dim n4 As String = "122"

        num = CDbl(n1)
        Console.WriteLine("Double Number: {0}", num)

        num = CDbl(n2)
        Console.WriteLine("Double Number: {0}", num)

        num = CDbl(n3)
        Console.WriteLine("Double Number: {0}", num)

        num = CDbl(n4)
        Console.WriteLine("Double Number: {0}", num)
    End Sub
    
End Module

Output

Double Number: 10.25
Double Number: 12
Double Number: 25.35
Double Number: 122
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply