Convert decimal number to hexadecimal

This program accepts decimal number and then finds the hexadecimal equivalent of it.Variable dec is used to accept decimal input.It is then divided by 16 and the remainder is stored in array rem.The quotient obtained after the division is considered as variable dec.This process continous until 0 is obtained as quotient.When 0 is obtained as quotient ,the hexadecimal equivalent of the variable dec is stored in array rem.

#include < stdio.h >
#include < conio.h > 
void main()
{
	int dec,rem[20],i,max,r;
	
	clrscr();
	printf("\n Enter a decimal number : ");
	scanf("%d",&dec);
	i = 0;	
	while ( dec != 0 )
	{
		r = dec % 16;
		dec = dec / 16;
		rem[i] = r;
		i++;
	} // while
	i = i-1;	
	while ( i >=0)
	{
		if ( rem[i] < 10 )
		printf("%d",rem[i]);
		else
		printf("%c",55 + rem[i]);
		i--;
	} // while
} // main