67.6k 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
8.0k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.