Number conversion (binary,decimal,octal,hexadecimal)
#include<stdio.h>
#include<conio.h>
void main()
{
char base16[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
long num;
long cnum[68];
int base,number,i,j;
clrscr();
printf("\nEnter a decimal number to convert : ");
scanf("%ld",&num);
printf("\nEnter base for convert : 2(for binary),8(for octal),16(for hexadecimal) : ");
scanf("%d",&base);
i=0;
while(num!=0)
{
cnum[i]=num%base;
num=num/base;
i++;
}
i=i--;