The following program takes a decimal number as an input and prints its octal equivalent. This program is implemented using c.
Code:
#include<stdio.h>
int main()
{
int n,a[100],i,j;
printf("Enter a decimal number : ");
scanf("%d",&n);
for (i=0;n!=0;i++)
{
a[i]=n%8;
n=n/8;
}
printf("The octal equivalent is : ");
for (j=i-1;j>=0;j--)
{
printf("%d",a[j]);
}
return 0;
}
Output:



Developer, Tinkere, a proud Dad.. love to spend my available time playing with Tech!!