human
Program for decimal to hexadecimal conversion | function to convert decimal to hexadecimal.
char array to store hexadecimal number.
counter for hexadecimal number array.
temporary variable to store remainder.
storing remainder in temp variable ..
check if temp < 10.
printing hexadecimal number array in reverse order.
Driver Code"
Solution in Python:
assistant
#Here is code to program for decimal to hexadecimal conversion and the other steps required.
 def decToHexa ( n ) :
	hexaDeciNum = [ '0' ] * 100
	i = 0
	while ( n != 0 ) :
		temp = 0
		temp = n % 16
		if ( temp < 10 ) :
			hexaDeciNum [ i ] = chr ( temp + 48 )
			i = i + 1
		else :
			hexaDeciNum [ i ] = chr ( temp + 55 )
			i = i + 1
		n = int ( n / 16 )
	j = i - 1
	while ( j >= 0 ) :
		print ( ( hexaDeciNum [ j ] ) , end = " " )
		j = j - 1
n = 2545
decToHexa ( n )