This is a Visual Basic program that generates a geometric progression and displays the results in a list box. Geometric progression is a sequence of numbers where each subsequent number is found by multiplying the previous number by a fixed number which is called common ratio. The common ratio can be negative, an integer, a fraction and any number but it must not be a zero.
The general formula to find the nth term of the geometric progression is arn-1 , where a is the first number and r is the common ratio.
In visual basic, we employs the Do.... Loop Until statement to generate the numbers in a geometric progression.In this program, we need to insert three text boxes for the user to enter the first number, the common ratio and the number of terms. We also need to insert a list box to list the numbers. Besides that, a command button is need for the user to generate the numbers in the geometric progression.
To add the numbers to the list box, we use the AddItem method. The syntax is List1.AddItem n, where n can be any variable.
Copyright ® 2008 Dr.Liew Voon Kiong . All rights reserved |Contact: firstname.lastname@example.org