Jump to content

Count in octal: Difference between revisions

Added implementation in C#.
(→‎{{header|Go}}: added floating point example)
(Added implementation in C#.)
Line 82:
return 0;
}</lang>
=={{header|C sharp|C#}}==
<lang csharp>using System;
 
class Program
{
static void Main()
{
var number = 0;
do
{
Console.WriteLine(Convert.ToString(number, 8));
} while (++number > 0);
}
}</lang>
=={{header|C++}}==
This prevents an infinite loop by counting until the counter overflows and produces a 0 again. This could also be done with a for or while loop, but you'd have to print 0 (or the last number) outside the loop.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.