28
Given (by any means) two different natural numbers (of any reasonable size), output (by any means) the square of their sum as in the examples below:
Given 4 and 3, output:
12 12 12 12 9 9 9
12 12 12 12 9 9 9
12 12 12 12 9 9 9
16 16 16 16 12 12 12
16 16 16 16 12 12 12
16 16 16 16 12 12 12
16 16 16 16 12 12 12
Given 1 and 3, output:
3 9 9 9
3 9 9 9
3 9 9 9
1 3 3 3
Whitespace may vary within reason but the columns must be left-aligned, right-aligned, or (pseudo-)centered.
A trailing newline is fine, but standard loopholes are not.
This is code-golf so include a header like # LanguageName, 123
in your answer, where the number is chars (bytes for languages that are not text-based). Packing code to large Unicode chars is not allowed.
Bonus: -3 if your code outputs just one square when one of the numbers is 0; e.g. given 0 and 3, output:
9 9 9
9 9 9
9 9 9
what is the maximum value of the input numbers? thanks. – don bright – 2015-10-19T21:17:25.870
1@donbright No artificial limit. Only limit is what your computer and language can handle when it comes to representation, computation (with your chosen algorithm) and result. Potentially, a modern computer equipped with a printer that accepts data line by line, would have almost no limit... :-) – Adám – 2015-10-19T21:22:47.367
Is the square orientation a given, or can we rotate it 90 degrees? – John Dvorak – 2015-10-20T05:34:24.633
1Why the bonus for 0 values though? What would the expected output be if not just one square? – March Ho – 2015-10-20T09:15:16.690
@MarchHo That's why the bonus is so small. Still, some languages may not be able to handle empty arrays. – Adám – 2015-10-20T11:55:14.067
@JanDvorak The orientation must be as shown: First input's square in lower left corner, second input's in upper right. – Adám – 2015-10-20T12:01:02.190