This program converts a decimal input into a hexadecimal and octal value.But I also want to convert it top binary as well.So kindly guide me.
thanx

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a;
printf("Enter a number");
scanf("%d",&a);
printf("Decimal=%d",a);
printf("\nOctal=%o",a);
printf("\nHexadecimal=%x",a);

getch();
}

I think the whole point of this exercise is for you to write a function along the lines of

void convertToBase( int number, int base, char *result );

Assuming you know how to do this for base 10, through application of the / and % operators, the rest should follow naturally.