programming-examples/c/_Basic/C program for decimal to octal converter.c

17 lines
367 B
C
Raw Normal View History

2019-11-15 12:59:38 +01:00
#include<stdio.h>
void main()
{
long int dn,remainder,q;
int on[100],i=1,j;
printf("Enter any decimal number");
scanf("%ld",&dn);
q = dn;
while(q!=0)
{
on[i++]= q % 8;
q = q/ 8;
}
printf("Equivalent octal value %d: ",dn);
for(j = i -1 ; j> 0; j--)
printf("%d",on[j]);
}