Ten lines (Collection) - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Projects (http://qbasicnews.com/newforum/forum-12.html) +--- Thread: Ten lines (Collection) (/thread-10248.html) |
Ten lines (Collection) - lrcvs - 01-17-2010 'Program multiplication simple 'lrcvs '(MU) Spain '13 Jan 2010 'This program is based on: a * b = c >>> a = c / X CLS a$ = "9876543298789" b$ = "2468013" 'a * b 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 "Program = "; VAL(c$): PRINT : PRINT "Computer = "; VAL(a$) * VAL(b$): END IF VAL(a$) < VAL(v$) THEN MID$(c$, r) = LTRIM$(STR$(s - 1)): EXIT FOR NEXT s NEXT r SLEEP END $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 'Program arithmetic division with integers numbers 'lrcvs '(MU) Spain '09 Jan 2010 CLS a$ = "9876598743014313" b$ = "388798006" 'A/B la = LEN(a$) 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 VAL(v$) = VAL(a$) THEN PRINT v$: EXIT FOR   IF VAL(a$) < VAL(v$) THEN MID$(c$, r) = LTRIM$(STR$(s - 1)): EXIT FOR   NEXT s NEXT r r$ = LTRIM$(STR$(VAL(a$) - (VAL(c$) * VAL(b$)))) d$ = LTRIM$(STR$(VAL(r$) / VAL(b$))) PRINT "Program = "; LTRIM$(STR$(VAL(c$))) + " . " + RIGHT$(d$, LEN(d$) - 1) PRINT "Remanence = "; r$ PRINT "Computer = "; VAL(a$) / VAL(b$) SLEEP END $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 'Program square root 'lrcvs '(MU) Spain '12 Jan 2010 CLS 'a$ = number to square root a$ = "25521342100008787" la = INT(LEN(a$) / 2) + 1 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(c$)))   IF VAL(a$) < VAL(v$) THEN MID$(c$, r) = LTRIM$(STR$(s - 1)): EXIT FOR   NEXT s NEXT r t$ = LTRIM$(STR$(VAL(a$) - (VAL(c$) * VAL(c$)))) d$ = LTRIM$(STR$(VAL(t$) / (VAL(c$)) / 2)) PRINT "Square root of = "; a$ PRINT "Program = "; LTRIM$(STR$(VAL(c$))) + " . " + RIGHT$(d$, LEN(d$) - 1) PRINT "Remanence = "; t$ PRINT "Computer = "; SQR(VAL(a$)) SLEEP END $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Re: Ten lines (Collection) - arockstar - 05-13-2011 Ya Its A One Of The Best And Simple Method For It I Am Also Want To Follow It But Its Did Creted By You Is The Same Thin Which I Want To Create So Good And Nice Re: Ten lines (Collection) - lrcvs - 05-13-2011 Thank you for your good opinion.! This program is free, use it well. It was fun doing this program, I hope you like. Greetings!!! |