Solving Circle and Factor in Visual Basic 2010
Solving Circle and Factor in Visual Basic 201
In this task, we will write a system that can solve for the circumference and area of a circle, as well as find the factors of a given number. We will be using Visual Basic 2010 for this implementation.
Code Generated System
Module CircleAndFactorSolver
Sub Main()
' Solving for Circle
Dim radius As Double
Dim circumference As Double
Dim area As Double
Console.WriteLine("Enter the radius of the circle:")
radius = Convert.ToDouble(Console.ReadLine())
circumference = 2 * Math.PI * radius
area = Math.PI * Math.Pow(radius, 2)
Console.WriteLine("Circumference of the circle: " & circumference)
Console.WriteLine("Area of the circle: " & area)
' Finding Factors
Dim number As Integer
Console.WriteLine("Enter a number to find its factors:")
number = Convert.ToInt32(Console.ReadLine())
Console.WriteLine("Factors of " & number & ":")
For i As Integer = 1 To number
If number Mod i = 0 Then
Console.WriteLine(i)
End If
Next
Console.ReadLine()
End Sub
End Module
Comments
Post a Comment