All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Smallest Number (Posted on 2004-01-25)
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.

 See The Solution Submitted by Ravi Raja Rating: 3.7500 (4 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re(2): Standard solution | Comment 18 of 23 |

10 CLS
20 LPRINT "FIMD THE SMALLEST NUMBER SUCH THAT IF ITS RIGHT MOST"
30 LPRINT "DIGIT IS PLACED AT ITS LEFT END, THE NEW NUMBER SO"
40 LPRINT "FORMED IS PRECISELY FIFTY PERCENT LARGER THAN THE"
50 LPRINT "ORIGINAL NUMBER."
60 A = 0: B = 0: C = 0: D = 0: E = 0: F = 0
70 A = A + 1
80 B = B + 1
90 C = C + 1
100 D = D + 1
110 E = E + 1
120 F = F + 2
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
150 IF F > 9 THEN F = 0: GOTO 110
160 IF E > 9 THEN E = 0: GOTO 100
170 IF D > 9 THEN D = 0: GOTO 90
180 IF C > 9 THEN C = 0: GOTO 80
190 IF B > 9 THEN B = 0: GOTO 70
200 IF A > 9 THEN 250
210 REM LPRINT USING "###,###,###,### ###,###,###,###"; N1; N2
220 IF N2 = (N1 * .5) + N1 THEN 230 ELSE 120
230 LPRINT USING "#,###,### #,###,###"; N1; N2
231 LPRINT USING "#,###,### * .5 = #,###,### + #,###,### #,###,###"; N1; N1 * .5 + N1; N1; N2
240 LPRINT CHR\$(12)
250 END

 Posted by Dale on 2004-01-31 10:35:11

 Search: Search body:
Forums (0)