source file name: Convallfn.C

void main()

{

void conv(int n, int b);

int n;

clrscr();

printf("\n enteu any Natural  number :\n");

scanf("%d",&n);

conv(n,2);

conv(n,8);

conv(n,16);

getch();

}

void conv(int n, int b)

{

int rem[15];

int i=0;


while(n>0)

{

rem[i]=n%b;

n=n/b;

i++;

}

if(b==2)

printf("\n Binary Conversion  :\n");

if(b==8)

printf("\n Octal Conversion  :\n");

if(b==16)

printf("\n Hexadecimal Conversion  :\n");


for(i=i-1;i>=0;i--)

{

if(rem[i]>9)

 printf(" %c ",rem[i]+55);

else

 printf(" %d ",rem[i]);

}

}

output: