C Program to Convert Decimal Number into Octal
The octal numeral system is the base-8 number system, and uses the digits 0 to 7.
- //C program to convert decimal to octal
- #include <stdio.h>
-
- int main()
- {
- long decinum, remainder, quotient;
- int octnum[100], i = 1, j;
-
- printf("Enter the decimal number: ");
- scanf("%ld", &decinum);
- quotient = decinum;
- while (quotient != 0)
- {
- octnum[i++] = quotient % 8;
- quotient = quotient / 8;
- }
- printf("Equivalent octal value of decimal no %d: ", decinum);
- for (j = i - 1; j > 0; j--)
- printf("%d", octnum[j]);
- return 0;
- }
Output

Solution not working or have any suggestions? Please send an email to [email protected]
Download Android App