របៀបសរសេរកូដរកក្រលាផ្ទៃក្នុង Visual Basic!

អនុវត្តតាមនេះ

Option Strict On
Option Explicit On

Module Module1

    Sub Main()
        'Rectangle Program
        'Takes data input for leght and width
        'Computes perimeter and area and prints all data console
        Dim leght = 0.0
        Dim width = 0.0
        'input
        Console.WriteLine("Enter leght of rectangle:")
        leght = Integer.Parse(Console.ReadLine().Trim())
        Console.WriteLine("Enter width of rectangle:")
        width = Integer.Parse(Console.ReadLine().Trim())
        'perimeter = 2*(leght + width)
        'area      = leght * width
        Dim perimeter = 2 * (leght + width)
        Dim area = leght * width
        Console.WriteLine("Leght of Rectangle:" & leght.ToString("N2"))
        Console.WriteLine("Width of Rectangle:" & width.ToString("N2"))
        Console.WriteLine("Perimeter of Rectangle:" & perimeter.ToString("N2"))
        Console.WriteLine("Area of Rectangle:" & area.ToString("N2"))
        Console.WriteLine("Good Bye!")
        Console.ReadKey()

    End Sub

End Module

Share on Google Plus

About usee

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment