0 Members and 1 Guest are viewing this topic.
Your program adds a zero to the end of the number penguin.
Quote from: ElementCoder on November 13, 2012, 01:35:10 pmYour program adds a zero to the end of the number penguin.I guess it all depends on how your for loop works. But I fixed it to work on calculators.
Define reverse(num)=Prgm Local final,reps,next,a final:=0 reps:=int(log(num,10))+1 For a,0,reps next:=int(((num)/(10))) final:=final*10+num-10*next num:=next EndFor result = final/10 Disp resultEndPrgm
Define reversefunc(num)=FuncLocal final,reps,next,afinal:=0reps:=int(log(num,10))+1For a,0,reps next:=int(((num)/(10))) final:=final*10+num-10*next num:=nextEndForReturn ((final)/(10))EndFunc
Define reverse()=Prgm Local reverse,n,a RequestStr “ ”,a n:=dim(a) reverse:=mid(a,n,1) For x,1,n-1 reverse:= reverse& reverse:=mid(a,n-x,1) EndFor reverse:=expr(reverse) Disp reverseEndPrgm
Define LibPub inversor()=Prgm:Local final,reps,next,a:f:=103:Lbl g:num:=f:final:=0:reps:=int(log(num,10))+1:For a,0,reps:next:=int(((num)/(10))):final:=final*10+num-10*next:num:=next:EndFor:resulti:=((final)/(10)):num:=resulti-f:l:=num:Disp "O Inverso de ",f," é ",resulti," logo:":Disp resulti,"-",f,"=",l:Local final,reps,next,a:final:=0:reps:=int(log(num,10))+1:For a,0,reps:next:=int(((num)/(10))):final:=final*10+num-10*next:num:=next:EndFor:resultii:=((final)/(10)):Disp "O inverso de ",l," é ",resultii," logo:":Disp resultii,"+",l,"=",resultii+l:Lbl e:f:=f+1:If f≥998 Then:Goto h:ElseIf f≥103 and f≤109 Then:Goto g:ElseIf f≥113 and f≤119 Then:Goto g:ElseIf f≥123 and f≤129 Then:Goto g:ElseIf f≥133 and f≤139 Then:Goto g:ElseIf f≥143 and f≤149 Then:Goto g:ElseIf f≥153 and f≤159 Then:Goto g:ElseIf f≥163 and f≤169 Then:Goto g:ElseIf f≥173 and f≤179 Then:Goto g:ElseIf f≥183 and f≤189 Then:Goto g:ElseIf f≥193 and f≤199 Then:Goto g:ElseIf f≥204 and f≤209 Then:Goto g:ElseIf f≥214 and f≤219 Then:Goto g:ElseIf f≥224 and f≤229 Then:Goto g:ElseIf f≥234 and f≤239 Then:Goto g:ElseIf f≥244 and f≤249 Then:Goto g:ElseIf f≥254 and f≤259 Then:Goto g:ElseIf f≥264 and f≤269 Then:Goto g:ElseIf f≥274 and f≤279 Then:Goto g:ElseIf f≥284 and f≤289 Then:Goto g:ElseIf f≥294 and f≤299 Then:Goto g:ElseIf f≥305 and f≤309 Then:Goto g:ElseIf f≥315 and f≤319 Then:Goto g:ElseIf f≥325 and f≤329 Then:Goto g:ElseIf f≥335 and f≤339 Then:Goto g:ElseIf f≥345 and f≤349 Then:Goto g:ElseIf f≥355 and f≤359 Then:Goto g:ElseIf f≥365 and f≤369 Then:Goto g:ElseIf f≥375 and f≤379 Then:Goto g:ElseIf f≥385 and f≤389 Then:Goto g:ElseIf f≥395 and f≤399 Then:Goto g:ElseIf f≥406 and f≤409 Then:Goto g:ElseIf f≥416 and f≤419 Then:Goto g:ElseIf f≥426 and f≤429 Then:Goto g:ElseIf f≥436 and f≤439 Then:Goto g:ElseIf f≥446 and f≤449 Then:Goto g:ElseIf f≥456 and f≤459 Then:Goto g:ElseIf f≥466 and f≤469 Then:Goto g:ElseIf f≥476 and f≤479 Then:Goto g:ElseIf f≥486 and f≤489 Then:Goto g:ElseIf f≥496 and f≤499 Then:Goto g:ElseIf f≥507 and f≤509 Then:Goto g:ElseIf f≥517 and f≤519 Then:Goto g:ElseIf f≥527 and f≤529 Then:Goto g:ElseIf f≥537 and f≤539 Then:Goto g:ElseIf f≥547 and f≤549 Then:Goto g:ElseIf f≥557 and f≤559 Then:Goto g:ElseIf f≥567 and f≤569 Then:Goto g:ElseIf f≥577 and f≤579 Then:Goto g:ElseIf f≥587 and f≤589 Then:Goto g:ElseIf f≥597 and f≤599 Then:Goto g:ElseIf f≥608 and f≤609 Then:Goto g:ElseIf f≥618 and f≤619 Then:Goto g:ElseIf f≥628 and f≤629 Then:Goto g:ElseIf f≥638 and f≤639 Then:Goto g:ElseIf f≥648 and f≤649 Then:Goto g:ElseIf f≥658 and f≤659 Then:Goto g:ElseIf f≥668 and f≤669 Then:Goto g:ElseIf f≥678 and f≤679 Then:Goto g:ElseIf f≥688 and f≤689 Then:Goto g:ElseIf f≥698 and f≤699 Then:Goto g:ElseIf f=709 Then:Goto g:ElseIf f=719 Then:Goto g:ElseIf f=729 Then:Goto g:ElseIf f=739 Then:Goto g:ElseIf f=749 Then:Goto g:ElseIf f=759 Then:Goto g:ElseIf f=769 Then:Goto g:ElseIf f=779 Then:Goto g:ElseIf f=789 Then:Goto g:ElseIf f=799 Then:Goto g:Else:Goto e:EndIf:Lbl h:EndPrgm
if <contition> or <condidtion> ...goto gelsegoto eend