accurate factonals

General FreeBASIC programming questions.
bluatigro
Posts: 651
Joined: Apr 25, 2012 10:35
Location: netherlands

accurate factonals

Postby bluatigro » Apr 01, 2020 12:54

if you want more digits
change const l

Code: Select all

const as integer l = 50
dim as byte f( l )
dim as string in
input "n = " ; in
f( 0 ) = 1

dim as integer i , m , c , n
n = val( in )
for m = 1 to n
  c = 0
  for i = 0 to l - 1
    f( i ) = f( i ) * m + c
    c = int( f( i ) / 10 )
    f( i ) = f( i ) - 10 * c
  next i
next m
for i = l to 0 step -1
  print str( f( i ) ) ;
next i
print
sleep
 

Return to “General”

Who is online

Users browsing this forum: No registered users and 5 guests