67.5k views
0 votes
Write a program that computes and display the n! for any n in the range1...100​

1 Answer

3 votes

Answer:

const BigNumber = require('bignumber.js');

var f = new BigNumber("1");

for (let i=1; i <= 100; i++) {

f = f.times(i);

console.log(`${i}! = ${f.toFixed()}`);

}

Step-by-step explanation:

Above is a solution in javascript. You will need a bignumber library to display the numbers in full precision.

User Dominique Barton
by
5.3k points