Ledger Nano X - The secure hardware wallet
SHARE
TWEET

06. Multiplication Table - sampleExam

vborislavova Mar 28th, 2020 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (input) {
  2.     let n = Number(input.shift());      
  3.     let singleDigitNum = 0;        
  4.     let doubleDigitNum = 0;      
  5.     let tripleDigitNum = 0;        
  6.  
  7.  
  8.     singleDigitNum = n % 10;
  9.  
  10.     doubleDigitNum = (n / 10) % 10;
  11.    
  12.     tripleDigitNum = n / 100;
  13.  
  14.     for (let singleD = 1; singleD <= singleDigitNum; singleD++)        
  15.     {
  16.         for (let doubleD = 1; doubleD <= doubleDigitNum; doubleD++)    
  17.         {
  18.             for (let tripleD = 1; tripleD <= tripleDigitNum; tripleD++)
  19.             {
  20.                 console.log(`${singleD} * ${doubleD} * ${tripleD} = ${singleD * doubleD * tripleD};`);
  21.                
  22.             }
  23.         }
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top