Get the length and width of a rectangular field.Calculate the area and perimeter and display it
Module Module1
Sub Main()
'Get the length and width of a rectangular field
Console.Write("Enter the length of a rectangular field: ")
Dim length As Integer = Integer.Parse(Console.ReadLine())
Console.Write("Enter the width of a rectangular field: ")
Dim width As Integer = Integer.Parse(Console.ReadLine())
'Calculate the area and perimeter and display it. Length 52.5 and width 18.6
Dim area As Double = length * width
Dim perimeter As Double = 2 * (length + width)
'display the area of a rectangular field
Console.WriteLine("The area of a rectangular field: " + area.ToString())
'display the perimeter of a rectangular field
Console.WriteLine("The perimeter of a rectangular field: " + perimeter.ToString())
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment