Loop statements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • trinny1976
    New Member
    • Apr 2010
    • 1

    Loop statements

    I'm trying to request a number, n, from 1 to 30 and one of the letters S or P. Then, depending upon whether S or P was selected, calculate the sum or product of the numbers from 1 to n. The program should be done in aflowchart form
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    busted! .... so since we did the last guy's homework for him, I guess you can have it too... http://bytes.com/topic/visual-basic/...5693-next-loop

    Comment

    • patjones
      Recognized Expert Contributor
      • Jun 2007
      • 931

      #3
      @yarbrough40: We should make people work a little harder than that! :-P

      If you want to impress people, implement these two processes recursively, whereby the function definitions call themselves. In this way you don't need to use For loops to solve the problem.

      Pat

      Comment

      • yarbrough40
        Contributor
        • Jun 2009
        • 320

        #4
        completely agree! - that is a smarter approach. overall, I lost interest in revisiting the solution knowing this guy asked the EXACT same question which is obviously a homework assignment.

        Comment

        Working...