#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Help me convert decimal number to hexadecimal number

Member Posts: 7
I want to convert decimal number to hexadecimal number and recovert it.
example
if I get 3F I want to convert it to 63.(convert decimal number to hexadecimal number)
and if I get 160 I want to convert it to A0. (convert hexadecimal number to decimal number)

Thank you

## Comments

• Member Posts: 9,765 ✭✭✭
: I want to convert decimal number to hexadecimal number and recovert it.
: example
: if I get 3F I want to convert it to 63.(convert decimal number to hexadecimal number)
: and if I get 160 I want to convert it to A0. (convert hexadecimal number to decimal number)
:
: Thank you
:
:

To convert from decimal to hex:
char buf[16];
int x = 63;
sprintf(buf,"%X",x);
convert it back to decimal
x = 0;
sscanf(buf,"%X", &x);

• Member Posts: 0

_ < http://forcoder.org /> free ebooks and video tutorials about // C++ PHP Ruby R Swift Python Go C# C Delphi Perl JavaScript MATLAB Visual Basic Scratch Visual Basic .NET Objective-C Assembly PL/SQL Java Prolog Lisp Rust Scheme Apex ABAP Transact-SQL Hack Julia Clojure VBScript LabVIEW Erlang COBOL Logo ML Scala Crystal Ada Alice Lua SAS Bash D Dart Fortran F# Kotlin Awk FoxPro // _________

Sign In or Register to comment.