I need to implement an arithmetic algorithm for hexadecimal numbers. So I want every arithmetic operation i.e addition, multiplication, subtraction, and division to be performed in base 16.
Is there anyway to sort of set a base?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Please.
Modern computers work in binary, by directly operating on voltages that represent 1s and 0s. That’s just they way they work, you can’t change that in software.
What you can do is change the base used for I/O, so that you print out numbers in hexadecimal, for instance:
This will print:
Note that the variables are initialized from decimal numbers, but we can still print the values in hex.