adspace
Write a program that would find the nth term of a geometric
progression, given the value of
first term and common ratio. Any inbuilt function that the
language provides for calculating
exponent should not be used.
Answer Posted / Pankaj Kumar Verma
VB.NET Code: (This code doesn't use any built-in functions to calculate exponent.)
```vbnet
Public Function GetNthTerm(ByVal firstTerm As Decimal, ByVal commonRatio As Decimal, ByVal n As Integer) As Decimal
Dim term As Decimal = firstTerm
For i As Integer = 1 To n - 1
term *= commonRatio
Next
Return term
End Function
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the use of assembly?
How to retrieve images in sql server database through vb.net?
Explain the difference between system.string and system.stringbuilder classes?
What is early binding?
What is option strict?
How can I extract the formated word(bold,italic,underline,font,color etc) from the msword file.?
How to send xml file on server using http protocol?
Explain the difference between datatable and dataset?
How to store images in sql server database through vb.net?
What are the features of c# which are not present in vb.net?
Explain an assembly?
Explain how can we remove handlers at run time?