Posts

Showing posts from February 23, 2017

Program to enter value into the array and print

Module Module1 Sub Main() 'program to input value into array and print it out Dim arr(5) As Integer 'assigning array with integer in it Dim index As Integer 'assigning the counter to be used in the loop Console.WriteLine("Enter the values into the array") For index = 1 To 5 arr(index) = Console.ReadLine Next Console.WriteLine("The elements inside the aaray are: ") For index = 1 To 5 Console.Write(arr(index) & " ") Next Console.ReadKey() ' this line of the code holds the window to see the output End Sub End Module

Area of Circle

Module Module1 Sub Main() 'program to find the area of the circle Dim radius, Area, pi As Single Console.Write("Enter the radius of the circle: ") radius = Console.ReadLine pi = 3.14 Area = pi * radius * radius Console.WriteLine("The area of the circle is: " & Area) Console.ReadKey() 'This line of code is used to hold the output window to see the output End Sub End Module

Area of Square

Module Module1 Sub Main() 'Program to find the area of the square Dim length, Area As Integer Console.Write("Enter the length of the square: ") length = Console.ReadLine Area = length * length Console.WriteLine("The area of the square is: " & Area) Console.ReadKey() 'This line of code is used to hold the output window to see the output End Sub End Module