Results 1 to 19 of 19

Thread: [RESOLVED] thanks! Program help? am i doin this right?? pleasee

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2007
    Posts
    26

    Resolved [RESOLVED] thanks! Program help? am i doin this right?? pleasee

    The sum of the series 1/1 +1/2 +1/3.... never converges. Thus if you add enough terms you can reach any value/ For example it takes 4 terms of the series to reach 2 as 1 + 1/2 +1/3 +1/4 is 2.0833333 and 11 terms to reach 3.

    AM i writing this program correctly???


    Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculate.Click

    Dim thenumber As Integer
    Dim theterms As Integer
    Dim z As Integer
    Dim n As Integer
    Dim thesum As Decimal


    thenumber = CInt(number.Text)
    theterms = CInt(terms.Text)
    thesum = CDec(sum.Text)

    theterms = 1
    thesum = 0
    z = 1 / n
    n = 1



    Do While thesum < thenumber
    thesum = z
    z = z + z
    n = n + 1

    Loop



    terms.Text = CStr(theterms)
    sum.Text = CStr(thesum)

    I keep getting an error messege.... please help i am desperate
    Last edited by cthompson86; Feb 16th, 2007 at 07:18 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width