Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- 'Arithmetic()
- 'Geometric()
- Triangular()
- End Sub
- Sub Arithmetic()
- Dim CommonDifference As Integer
- Dim Output As Integer = 0
- Console.WriteLine("Please enter the common difference")
- CommonDifference = Console.ReadLine()
- For i = 1 To 20
- Console.WriteLine(Output)
- Output = Output + CommonDifference
- Next
- Console.ReadKey()
- End Sub
- Sub Geometric()
- Dim CommonRatio As Integer
- Dim Output As Integer
- Dim FirstValue As Integer
- Dim Value As Integer
- Console.WriteLine("Please input the common ratio")
- CommonRatio = Console.ReadLine()
- Console.WriteLine("Please enter the first value of the term")
- FirstValue = Console.ReadLine()
- Value = FirstValue
- For i = 1 To 20
- Output = Value * CommonRatio
- Console.WriteLine(Output)
- Value = Output
- Next
- Console.ReadKey()
- End Sub
- Sub Triangular()
- Dim FirstValue As Integer
- Dim Value As Integer
- Dim Output As Integer
- Dim X As Integer = 1
- Dim Y As Integer = 1
- Console.WriteLine("Please input the first value")
- FirstValue = Console.ReadLine()
- Value = FirstValue
- For i = 1 To 20
- Output = Value * (Value + 1) / 2
- Console.WriteLine(Output)
- For j = 1 To Value
- Console.Write("@")
- If Y = j Then
- Console.WriteLine()
- Y = 0
- End If
- Y = Y + 1
- Next
- Console.WriteLine()
- Value = Value + 1
- Next
- Console.ReadKey()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment