Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to convert decimal into hexadecimal in C language needs to use the functions in the program.
How to convert decimal into hexadecimal in C language needs to use the functions in the program.
Master ()

{

Invalid change (integer);

int num

Printf ("Please enter this number:");

scanf("%d ",& ampnum);

Printf ("The hexadecimal form of this number is 0x%x\n", num);

//Directly output an integer in hexadecimal form.

Change (number);

}

Invalid change (integer)

{ char num 1[ 10];

sprintf(num 1,“%x”,s);

//Function //sprintf () saves variables in the specified format into a string.

Printf ("The hexadecimal form of this number is 0x%s\n", num1);

}

Description:

%d output integers in decimal form.

%o Output integers in octal form.

%x output integer in hexadecimal form of 16.