Javascript, 190 bytes
Late to the party, but I was piqued by @jdstankosky 's comment and decided to take a different approach. Here's a Javascript entry that mauls a template and evals itself along the way.
t="a*b=c ";u="";r=u;for(i=1;i<10;i++){a=0;u=u+t;r+=u.split(' ').map(x=>x.replace('a',++a).replace('b',i)).map(x=>x.replace('*','x').replace('c',eval(x.substr(0,3)))).join(' ')+'\n'}alert(r);
Un-golfed version (slightly older version in which a function returns the table instead of a script alerting it, but the same principles apply):
function f()
{
t="a*b=c "; // template for our multiplication table
u="";r=""; // tmp- and return values
for(i=1;i<10;i++)
{
a=0; // is auto-incremented in MAP
u=u+t;// extend the template once per iteration
v=u.split(' '); // Smash the template to pieces
w=v.map(x=>x.replace('a', ++a).replace('b', i)) // MAP replaces the A and B's with the correct numbers
w=w.map(x=>x.replace('*', 'x').replace('c', eval(x.substring(0,3)))).join(' '); // second map evals that and replaces c with the answer, makes the asteriks into an X
r=r+w+'\n' // results get concatenated
}
return r;
}
6Is anyone really going to do anything besides 2
for
loops? Where's the challenging (interesting) part? – jdstankosky – 2013-04-15T23:56:30.8273I don't use
for
. Ok, I usewhile
. – Johannes Kuhn – 2013-04-16T13:31:39.5203Are trailing spaces important? – Reinstate Monica – 2013-05-13T19:06:29.160
why in the first column there are 2 spaces and not 1? (as the other colums ) – RosLuP – 2016-09-20T15:21:15.910
@jdstankosky My answer uses the inverted upper triangle of a scaled identity matrix :). – Magic Octopus Urn – 2016-09-20T16:15:02.270
1@jdstankosky perhaps you may find my answer a bit more interesting - no loops involved – Taylor Scott – 2017-07-22T21:03:20.893
1Are we even allowed to use x in place of ×? (If not, that invalidates a whole lot of programs) – Zacharý – 2017-07-23T00:33:20.577
@jdstankosky I use a
time
loop! – sergiol – 2018-04-15T12:31:59.277