Multiplication simple

Announce and discuss the progress of your various programming-related projects...programs, games, websites, tutorials, libraries...anything!

Moderators: Pete, Mods

lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

Multiplication simple

Postby lrcvs » Fri Jan 15, 2010 8:21 am

'Program multiplication simple
'lrcvs
'(MU) Spain
'13 Jan 2010

'This program is based on: a * b = c >>> a = c / b

CLS

a$ = "9876543298789"
b$ = "2468013"

la = LEN(a$) + LEN(b$)
c$ = STRING$(la, "0")

FOR r = 1 TO la
FOR s = 0 TO 9
MID$(c$, r) = LTRIM$(STR$(s))
v$ = LTRIM$(STR$(VAL(c$) / VAL(b$)))
IF v$ = a$ THEN PRINT "Prog = "; VAL(c$): PRINT : PRINT "Comp = "; VAL(a$) * VAL(b$): END
IF VAL(a$) > VAL(v$) THEN MID$(c$, r) = LTRIM$(STR$(s))
IF VAL(a$) < VAL(v$) THEN MID$(c$, r) = LTRIM$(STR$(s - 1)): EXIT FOR
NEXT s
NEXT r
SLEEP
END

Return to “News and Announcements”

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests

cron