VB.Net program to demonstrate the CDec() function

You may have come across many doubts and confusions in the article. We guarantee that all your queries will be resolved via the VB.Net program to demonstrate the CDec() function article.

VB.Net program to demonstrate the CDec() function

VB.Net program to demonstrate the CDec() function

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

Module Module1

    Sub Main()
        Dim num As Decimal = 0

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

        num = CDec(n1)
        Console.WriteLine("Decimal Number: {0}", num)

        num = CDec(n2)
        Console.WriteLine("Decimal Number: {0}", num)

        num = CDec(n3)
        Console.WriteLine("Decimal Number: {0}", num)

        num = CDec(n4)
        Console.WriteLine("Decimal Number: {0}", num)
    End Sub
    
End Module
Decimal Number: 10.25
Decimal Number: 12
Decimal Number: 25.35
Decimal Number: 122
Press any key to continue . . .

Final Words

We hope the VB.Net program to demonstrate the CDec() function article clears up your doubts and confusion. See you again in a good article. Thanks.

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

Share on:

Leave a Comment