Show the (decimal) value of a number of 1s appended with a 3, then squared: Difference between revisions

(→‎AWK: simplify)
(→‎bc: add)
Line 173:
6 1111113^2 1,234,572,098,769
7 11111113^2 123,456,832,098,769
</pre>
 
=={{header|bc}}==
<syntaxhighlight lang="bc">x = 2
for (n = 0; n != 8; ++n) {
x = x * 10 - 17
x
" -> "
x * x
}</syntaxhighlight>
{{out}}
<pre>
3
-> 9
13
-> 169
113
-> 12769
1113
-> 1238769
11113
-> 123498769
111113
-> 12346098769
1111113
-> 1234572098769
11111113
-> 123456832098769
</pre>
 
Line 193 ⟶ 221:
return 0;
}</syntaxhighlight>
 
{{out}}
 
<pre> 3^2 = 9
13^2 = 169
559

edits