Count in octal: Difference between revisions
→{{header|Java}}
(Jakt) |
|||
Line 1,774:
=={{header|Java}}==
<syntaxhighlight lang="java">
void printCount() {
for (int value = 1; value <= 20; value++) {
if (value != 1)
System.out.print(", ");
/* the 'o' specifier will print the octal integer */
System.out.printf("%o", value);
}
}
</syntaxhighlight>
<pre>
1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24
</pre>
<br />
An alternate implementation
<syntaxhighlight lang="java">public class Count{
public static void main(String[] args){
|