Skip to content

Instantly share code, notes, and snippets.

@calvinf
Created July 17, 2012 18:12
Show Gist options
  • Save calvinf/3130954 to your computer and use it in GitHub Desktop.
Save calvinf/3130954 to your computer and use it in GitHub Desktop.
Multiplication Table in node.js
var util = require('util'),
sprintf = require('sprintf').sprintf, // npm install sprintf
rows = 10
for(var i=1;i<=rows;i++) {
for(var j=1;j<=rows;j++) {
var num = sprintf('%3d', i * j)
process.stdout.write(num + " ")
}
process.stdout.write("\n")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment