You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
programming-examples/c/Basic/C program for decimal to oc...

17 lines
367 B
C

#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]);
}