I made a program that finds the factors of a program, but it begins to get very slow. Is there any way to make this program more efficient?

Code:

ClrHome
Input "Integer: ",A
1->Y
1->X
For(B,1,A\2
   If fPart(A/B)=0
   Then
      Y+1->Y
      If Y>10
      Then
         1->Y
         X+4->X
      End
      Output(Y,X,B
   End
End
Y+1->Y
If Y>10
Then
   1->Y
   X+4->X
End
Output(Y,X,A
Pause
ClrHome

Also, how would I make this find negative factors?
For one, you could have it go from 1-int(root(B)+1). You could also test if Remainder is faster.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement