Activity 2
2. Determine the factorial of an input number without using multiplication. Use successive addition
CPE102L
1Q1819Info! Broken links? Email us at gtechphofficial@gmail.com
start
int factorial
int i=1, ifact=1
print "Enter a number: "
input factorial
int tempfact=factorial
int factstore=factorial-1
if (factorial==0)
print "invalid"
elseif (factorial<0)
print "Out of range"
else
while (i<=factorial)
int tempnew=tempfact
ifact=1
while (ifact<factstore)
tempfact=tempfact+tempnew
ifact++
endwhile
factstore--
i++
endwhile
print tempfact
end