Code for Program to convert decimal to octal in C Programming
#include<stdio.h>
#include<conio.h>
int i=0,bin[100];
void main()
{
int j=0;
int read(),destobin();
clrscr();
j=read();
destobin(j);
getch();
}
int read()
{
int num;
printf("\n PLEASE ENTER THE VALUE IN DECIMAL ( 0 - 7 ): ");
scanf("%d",&num);
return(num);
}
int destobin(int j)
{
for(i=0;j>0;i++)
{
bin[i]=j%8;
j=j/8;
}
i--;
printf("\nDECIMAL TO OCTAL CONVERSION IS ");
for(i;i>=j;i--)
printf("%d",bin[i]);
}