Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with my program

Status
Not open for further replies.

yubin100

MIS
Apr 6, 2007
1
CA
how to convert a number in one base to the same number in another using pascal
 
This is more a maths question than a Pascal one.

To convert to base 10.

32A (hex) = 3 * 16^2 + 2 * 16^1 + 10(A) * 16^0.
32A (hex) = 3 * 256 + 2 * 16 + 10 * 1.
32A (hex) = 768 + 32 + 10.
32A (hex) = 810.

To convert to base 16.

810 (dec)
810 / 16 = 50 rem 10.
50 / 16 = 3 rem 2.
3 / 16 = 0 rem 3.

Read numbers down to up, you get 32A.

Now it's up to you to code it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top