Apr 6, 2007 #1 yubin100 MIS Apr 6, 2007 1 CA how to convert a number in one base to the same number in another using pascal
Apr 6, 2007 #2 Glenn9999 Programmer Jun 19, 2004 2,311 US 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. Upvote 0 Downvote
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.