कंप्यूटर प्रोग्रामिंग/वेरिएबल/विजुअल बेसिक .नेट

विकिविश्वविद्यालय से
Jump to navigation Jump to search

variables.vb[सम्पादन | स्रोत सम्पादित करें]

Public Module Main
    Sub Main()
        Console.WriteLine("Variables and Data Types")
        Dim I As Integer = 1234567890
        Dim S As Single = 1.2345678f
        Dim D As Double = 1.234567890123456
        Dim ST As String = "string"
        
        Console.WriteLine("Integer: " + I.ToString())
        Console.WriteLine("Single: " + S.ToString())
        Console.WriteLine("Double: " + D.ToString())
        Console.WriteLine("String: " + ST)
        Console.WriteLine("")
        
        Console.WriteLine("Constants")
        Const PI As Single = 3.14159f
        Const C As String = "Constant"
        Console.WriteLine(PI.ToString() + "   " + C)
        Console.WriteLine("")
    
        Console.WriteLine("Arithmetic Operators")
        Dim A As Integer = 3
        Dim B As Integer = 2
        Console.WriteLine("A = " + A.ToString())
        Console.WriteLine("A = " + B.ToString())
        Console.WriteLine("A + B = " + (A + B).ToString())
        Console.WriteLine("A - B = " + (A - B).ToString())
        Console.WriteLine("A * B = " + (A * B).ToString())
        Console.WriteLine("A / B = " + (A / B).ToString())
        Console.WriteLine("")
        
        Console.WriteLine("Assignment Operators")
        A += B
        Console.WriteLine("A += B is " + A.ToString())
        A -= B
        Console.WriteLine("A -= B is " + A.ToString())
        A *= B
        Console.WriteLine("A *= B is " + A.ToString())
        A /= B
        Console.WriteLine("A /= B is " + A.ToString())
        Console.WriteLine("")
    
        Dim Username As String
        Console.WriteLine("User Input")
        Console.Write("What is your name? ")
        Username = Console.ReadLine()
        Console.WriteLine("Hello " + Username + "!")
    End Sub
End Module

कोशिश करो[सम्पादन | स्रोत सम्पादित करें]

निम्न कोड मुफ्त ऑनलाइन विकास के वातावरण में से एक में ऊपर कॉपी और पेस्ट करो या अपने खुद के कम्पाइलर/इंटरप्रेटर/आईडीई का उपयोग करें।

यह भी देखें[सम्पादन | स्रोत सम्पादित करें]