Display Multiplication Table With A Command Line

If you forgot your multiplication table and happen to have a terminal window opened in Linux  at the time, here’s the command to use:

seq 9 | sed ‘H;g’ | awk -v RS=” ‘{for(i=1;i<=NF;i++)printf(“%dx%d=%d%s”, i, NR, i*NR, i==NR?”\n”:”\t”)}’

Same thing using perl:

Here’s the output:


Source (in French): http://www.tux-planet.fr/afficher-les-tables-de-multiplication-en-ligne-de-commande/

Support CNX Software - Donate via PayPal or become a Patron on Patreon

Leave a Reply

avatar
  Subscribe  
Notify of