Find the smallest number such that if its rightmost digit is placed at its left end, the new number so formed is precisely 50% larger than the original number.
(In reply to
re: Standard solution by Ady TZIDON)
10 CLS
20 PRINT "FIMD THE SMALLEST NUMBER SUCH THAT IF ITS RIGHT MOST"
30 PRINT "DIGIT IS PLACED AT ITS LEFT END, THE NEW NUMBER SO"
40 PRINT "FORMED IS PRECISELY FIFTY PERCENT LARGER THAN THE"
50 PRINT "ORIGINAL NUMBER."
60 A = 0: B = 0: C = : D = 1: E = 0: F = 0
120 F = F + 2
121 IF F > 9 THEN F = 0: E=E+1
122 IF E > 9 THEN E = 0: D=D+1123 IF D > 9 THEN D = 0: C=C+1
124 IF C > 9 THEN C = 0: B=B+1
125 IF B > 9 THEN B = 0: A=A+1
126 IF A > 9 THEN 250
130 N1 = A * 100000 + B * 10000 + C * 1000 + D * 100 + E * 10 + F
140 N2 = F * 100000 + A * 10000 + B * 1000 + C * 100 + D * 10 + E
146 REM WAIT &H20, 1
201 REM PRINT USING "# # # # # # # # # # # #"; A; B; C; D; E; F; F; A; B; C; D; E
202 REM PRINT USING "###,###,###,### ###,###,###,###"; N1; N2
222 IF N2 = (N1*.5)+N1 THEN 230 ELSE 120
230 PRINT USING "#,###,### #,###,###"; N1; (N2 * .5) + N2
240 REM PRINT CHR$(12)
250 END

Posted by Dale
on 20040131 10:28:53 