Hello everyone!
I developed a program which
1. Can give you factorial of any positive integer. For example 1000!
2. Raise a positive integer to any positive integer. For example 2^2000
3. Can give the product of any positive integer. For example 896346326469864398643969869463294269846946329423986*78343664782643876748367483676438
Steps to setup the program -
1. Paste the code in QB64 IDE and save it with the name "fpm.bas"
2. Open the commandline and start executing commands in it.
3. Try "fpm -help" for more info.
[ This attachment cannot be displayed inline in 'Print Page' view ]
'#####################################
'# #
'# FPM by Ashish #
'# #
'#####################################
'28 Jun, 2019
'Save the file with name "fpm.bas" and then compile to produce fpm.exe/fpm.
'and then use commandline interface for executing commands in it.
_ECHO "--------------------------------------" _ECHO "* FPM by Ashish *" _ECHO "--------------------------------------" _ECHO " Usage - fpm [function_name]([arguements])" _ECHO "List of arguements -" _ECHO "Syntax - mult(a,b) | where a,b are positive integers of any digit." _ECHO "Example : Try fpm mult(2,7)" _ECHO "Syntax - pow(a,b) |where a,b are positive integers of any digit." _ECHO "Example : Try fpm pow(3,2)" _ECHO "Syntax - fact(a) | where a is positive integer of any digit." _ECHO "Returns a! , that is 1*2*3*...*(a-1)*a" _ECHO "Example : Try fpm fact(10)"
c$ = "1"
IF n~&&
> 500 THEN _ECHO "Can take " + STR$(2 ^ ((n~&&
/ 500) + 1)) + " seconds or more." c$
= MID$(a$
, i
+ 1, LEN(a$
) - (i
+ 1)) d$ = b$
d$ = mult(d$, b$)
res$
(LEN(n2$
) - i
) = mult_single_dgt
(n1$
, dgt$
1) + STRING$(LEN(n2$
) - i
, "0") p0 = p1
' _echo res$(i)
sum = 0
sum
= sum
+ VAL(MID$(res$
(j
), i
, 1)) ' ? sum
final_dgt$
= RIGHT$(str_sum$
, 1) final_dgt$ = str_sum$
carry = 0
final_dgt$ = str_sum$
temp$ = ""
temp$
= temp$
+ MID$(final_dgt$
, j
, 1) final_dgt$ = temp$
final_sum$ = final_sum$ + final_dgt$
mult$
= mult$
+ MID$(final_sum$
, i
, 1)
r
= (VAL(dgt_1$
1) * VAL(d$
)) + carry
' ? r
tmp$ = ""
tmp$
= tmp$
+ MID$(final$
, k
, 1) final$ = tmp$
product$ = product$ + final$
mult_single_dgt$
= mult_single_dgt$
+ MID$(product$
, j
, 1) ELSE mult_single_dgt$
= product$