can anyone give me the program in turbo C++ for the conversion of decimal numbers to hexadecimal numbers, octal numbers to decimal numbers. it will be so kind of you.
thanx.

Recommended Answers

All 3 Replies

Use integer division and remainder operations with 16 or 10 or 8.

As i think about this thread we should divide by 16 the no. in decimal to convert in hexadecimal untill we get remainder 0 then remainder left should be return in reverse order
ex-
22 in decimal
/16 1 quotient 6 is remainder
again 1/16 1
answer is 16

The two previous posters are correct, just a note although the logic behind it is not too hard, i would suggested you go over the manual method on paper so you know for sure what you are doing before you start writting some code. Otherwise you may get even more confused.

Chris

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.