Sunday, February 19, 2012

C Program to convert decimal number to octal - c programs


C Program to convert decimal number to octal - c programs


//C Program to convert decimal number to octal 
// Decimal number to octal conversion in / using c

#include <stdio.h>
void main() 

int i=0,n,b[100];
printf("\n For Decimal to octal converstion");
printf("\nEnter decimal number: "; 
scanf("%d",&n);
while (n>0) 
{
b[i]=n%8; 
n=n/8; 
i++; }
printf("\n octal is: "); 
while(i>0)

printf(b[i]);
i--;
}

No comments:

Post a Comment