Multiplication tables: Difference between revisions

Content added Content deleted
Line 61: Line 61:
int i,j;
int i,j;


dgts = (int)(.99+ log(1.0*max*max)/log(10.0));
dgts = (int)(.99+ log10(1.0*max*max));
sprintf(format," %%%dd", dgts);
sprintf(format," %%%dd", dgts);
sprintf(format2,"%%%ds%%c", dgts);
sprintf(format2,"%%%ds%%c", dgts);
Line 95: Line 95:


</pre>
</pre>

=={{header|C++}}==
=={{header|C++}}==
This is a slightly more-generalized version that takes any minimum and maximum table value, and formats the table columns.
This is a slightly more-generalized version that takes any minimum and maximum table value, and formats the table columns.