#include<stdio.h>

#include<conio.h>

int main()

{

long dnum, quotient;

int onum[100], i = 1, j;

clrscr();

printf(“Enter the decimal number: “);

scanf(“%ld”, &dnum);

quotient = dnum;

while (quotient != 0)

{

onum[i++] = quotient % 8;

quotient = quotient / 8;

}

printf(“Equivalent octal value of decimal no %d: “, dnum);

for (j = i – 1; j > 0; j–)

printf(“%d”, onum[j]);

getch();

return(0);

}

Output:-

Advertisements