navyfalcon
Advanced Newbie
Joined: 17 Mar 2008 Posts: 77
|
Posted: 04 Jul 2010 04:29:04 pm Post subject: |
|
|
MLTIPLY prgm does not work for zeros
Tried several emails to the author
written by austin granger (agranger@visi.com)
no response
-
http://www.ticalc.org/pub/83plus/basic/math/arithmetic/
prgmMTIPLY
-
program has problems with zeros
two digits
top number any two digits (not zeros
XX
20
--
done
does not multiply for:
20, 30, 40, etc.
-
Does anyone know what the error is ??
-
Thank You falcon
MTIPLY prgm from ticalc.org
-
prgmMTIPLY
Menu("DIGITS?","TWO",AA,"THREE",BB
Lbl AA
Input "TOP NUMBER",A
Input "BOTTOM NUMBER",B
10->C
Lbl CC
C+10->C
If C>B
Then
C-10->C
Goto DD
End
If C<B
Then
Goto CC
Lbl DD
B-C->E
ClrHome
Output(1,3,A)
Output(2,3,
Output(2,1,"*")
Output(3,1,"------")
Output(4,4,E*A)
Output(5,3,C*A)
Output(6,1,"------")
Output(7,3,(A*)
Goto ZZ
Lbl BB
Input "TOP NUM",A
Input "BOTTOM NUM",B
10->C
100->D
Lbl II
D+100->D
If D>B
Then
D-100->D
Goto JJ
End
If D<B
Then
Goto II
End
Lbl JJ
B-D->E
Lbl KK
C+10->C
If C>E
Then
C-10->C
Goto LL
End
If C<E
Then
Goto KK
End
Lbl LL
E-C->G:ClrHome
Output(1,3,A)
Output(2,3,
Output(2,1,"*")
Output(3,1,"------")
Output(4,4,G*A)
Output(5,3,C*A)
Output(6,2,D*A)
Output(7,1,"------"
Output(8,2,A*
Goto ZZ
Lbl ZZ
Pause
ClrHome
Menu("AGAIN?","YES",SU,"NO",US)
Lbl SU
prgmMULTIPLY
Lbl US
Stop
_____ |
|
Bhaliar
Member
Joined: 16 Nov 2009 Posts: 221
|
Posted: 07 Jul 2010 01:08:20 pm Post subject: |
|
|
navyfalcon wrote:
MLTIPLY prgm does not work for zeros
Tried several emails to the author
written by austin granger (agranger@visi.com)
no response
-
http://www.ticalc.org/pub/83plus/basic/math/arithmetic/
prgmMTIPLY
-
program has problems with zeros
two digits
top number any two digits (not zeros
XX
20
--
done
does not multiply for:
20, 30, 40, etc.
-
Does anyone know what the error is ??
-
Thank You falcon
MTIPLY prgm from ticalc.org
-
prgmMTIPLY
Menu("DIGITS?","TWO",AA,"THREE",BB
Lbl AA
Input "TOP NUMBER",A
Input "BOTTOM NUMBER",B
10->C
Lbl CC
C+10->C
If C>B
Then
C-10->C
Goto DD
End
If C<B
Then Delete this line. It causes the skip that makes you quit when you use 20.
Goto CC
Lbl DD
B-C->E
ClrHome
Output(1,3,A)
Output(2,3,
Output(2,1,"*")
Output(3,1,"------")
Output(4,4,E*A)
Output(5,3,C*A)
Output(6,1,"------")
Output(7,3,(A* )
Goto ZZ
Lbl BB
Input "TOP NUM",A
Input "BOTTOM NUM",B
10->C
100->D
Lbl II
D+100->D
If D>B
Then
D-100->D
Goto JJ
End
If D<B
Then
Goto II
End
Lbl JJ
B-D->E
Lbl KK
C+10->C
If C>E
Then
C-10->C
Goto LL
End
If C<E
Then
Goto KK
End
Lbl LL
E-C->G:ClrHome
Output(1,3,A)
Output(2,3,
Output(2,1,"*")
Output(3,1,"------")
Output(4,4,G*A)
Output(5,3,C*A)
Output(6,2,D*A)
Output(7,1,"------"
Output(8,2,A*
Goto ZZ
Lbl ZZ
Pause
ClrHome
Menu("AGAIN?","YES",SU,"NO",US)
Lbl SU
prgmMULTIPLY
Lbl US
Stop
_____
Okay so I ran it and see what you mean, and found the problem. When you use the number 20 in either variable, it equals C, which isn't one of the conditionals. It only allows for if c is greater or lesser then, so the code skips those two conditionals, and moves on, not having to edit. the creator then forgot an end. I put the solution in the quote above.
Last edited by Guest on 07 Jul 2010 03:59:18 pm; edited 1 time in total |
|