Decimal To Octal
This algorithm converts decimal numbers to octal numbers.
public static string DecimalToOctal(int dec)
{
if (dec < 1) return "0";
string octStr = string.Empty;
while (dec > 0)
{
octStr = octStr.Insert(0, (dec % 8).ToString());
dec /= 8;
}
return octStr;
}
Example
int data = 667887;
string value = DecimalToOctal(data);
Output
2430357