Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Programming Puzzle 24 - So you think you know long division?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Programming Puzzle 24 - So you think you know long division?

    Puzzle 24 - So you think you know long division?

    The professor has discovered a number that has unique properties.

    If you divide this number by 2 you get a remainder of 1.
    If you divide this number by 3 you get a remainder of 2.
    If you divide this number by 4 you get a remainder of 3.
    And so on...
    The sequence continues until finally, if you divide
    this number by 10 you get a remainder of 9!

    Your task grasshopper is to write an xbasic program that will
    find this number, and display your proof in the Alpha Five
    trace window.

    In order to avoid negatively impacting the nation's gross
    domestic product the professor has a hint for you. The
    number is more than 2,000 and less than 3,000.

    Bonus points will be awarded to the most efficient solutions.
    So include a timer in your code and report the results in
    your solution if you try for the bonus points.

    Have fun.




    Credit EasyCalculation.com for the idea behind this puzzle.

    #2
    Re: Programming Puzzle 24 - So you think you know long division?

    hello
    here is my solution...
    i have not tried timer yet. so i will lose my bonus point
    i am also using message box so i will not qualify for anything...
    Code:
    dim x as n
    for x = 2000 to 3000
    	if mod(x,10)=9
    		if mod(x,9)=8
    			if mod(x,8)=7
    				if mod(x,7)=6
    					if mod(x,6)=5
    						if mod(x,5)= 4
    							if mod(x,4)=3
    								if mod(x,3)=2
    		msgbox("The number is ",str(x))
    								end if
    							end if
    						end if
    					end if
    				end if
    			end if
    		end if
    	end if
    		next
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    [email protected]
    Skype:[email protected]
    1 914 924 5171

    Comment


      #3
      Re: Programming Puzzle 24 - So you think you know long division?

      hello
      now i have added elapsed time, also using msgbox - not eligible for anything.
      elapsed time shows "0 secs" i am not certain if i am doing the calculation correct.

      Code:
      dim t1 as y
      t1=ctot(time())
      dim t2 as y
      dim x as n
      for x = 2000 to 3000
      	if mod(x,10)=9
      		if mod(x,9)=8
      			if mod(x,8)=7
      				if mod(x,7)=6
      					if mod(x,6)=5
      						if mod(x,5)=4
      							if mod(x,4)=3
      								if mod(x,3)=2
      									t2=ctot(time())
      				d=(t2-t1)/60				
      				msgbox("The answer is",str(x))
      				msgbox("Elapsed time","It took "+alltrim(str(d))+" seconds")
      								end if
      							end if
      						end if
      					end if
      				end if
      			end if
      		end if
      	end if
      next
      Last edited by GGandhi; 05-29-2012, 05:55 AM. Reason: added alltrim
      thanks for reading

      gandhi

      version 11 3381 - 4096
      mysql backend
      http://www.alphawebprogramming.blogspot.com
      [email protected]
      Skype:[email protected]
      1 914 924 5171

      Comment


        #4
        Re: Programming Puzzle 24 - So you think you know long division?

        gandhi,

        Very nice! You got the correct answer.

        I asked Professor Pickypicky to look at your script. Unfortunately, he was a bit cranky since I woke him from his nap. Anyway, he had a few small observations for you.

        1) He thinks you should learn to use the trace window. Unlike the message box, the flow of the program is not interrupted when the script writes information to the trace window. Focus does not shift from the running program to the trace window. This can be a real problem in some cases when using msg boxes so it's very useful to know how to work with the trace window.

        2) He thinks your program keeps running after the solution is found, does it not? He thinks it unnecessary to keep testing values after the msgbox is displayed. In the interest of efficiency why not exit the For ... Next code block once the solution is found?

        3) The professor recommends that you compare the precision of the TIME() and NOW() functions that Alpha supplies. TIME() can't be used to measure intervals smaller than one second.

        Thanks for playing. Hope you found it an interesting exercise.

        -- tom

        Comment


          #5
          Re: Programming Puzzle 24 - So you think you know long division?

          thanks
          1> i changed time() to now() in my test script and it does show result less than 0 secs. (i did not resubmit the code)
          2> while building the script i did not exit for loop to see any other number pops up. none popped. i got distracted and did not add exit to the finished product.
          3> also i used trace.writeln in my test script and can see the results when i view the trace window.
          thanks again.
          thanks for reading

          gandhi

          version 11 3381 - 4096
          mysql backend
          http://www.alphawebprogramming.blogspot.com
          [email protected]
          Skype:[email protected]
          1 914 924 5171

          Comment


            #6
            Re: Programming Puzzle 24 - So you think you know long division?

            Very good!

            The professor is working on another puzzle, so stand by for more fun!

            Comment

            Working...
            X