• Register
632 points
7 1

C program to convert decimal to hexadecimal

If you are learning any programming language, you have to make a lot of changes while creating the program. As is our topic today. How to convert decimal number system to hexadecimal in c ++.  Should know what a decimal number system and a hexadecimal number system are.

 Number system

 The numerical system defines a set of values ​​to represent different quantities.  All the digits used in any number system are called the basis of this number system. The most commonly used number systems are as follows:

  •  Decimal number system
  •  Binary  number system,
  •  Octal number system
  •  Hexadecimal number system 

 Today we will see the process of changing these two number systems in the program after learning about the basis or base.

  Decimal number system. 

 A decimal number system consists of ten digits which are from 0 to 9. Any number is represented by the use of these ten digits. This number is called the basis of the system or base 10. For example in a decimal number system.  The basis of the number (583) is 10 .

  Hexadecimal number system.

The basis of hexadecimal number system is 16. From 0 to 9 then A, B, C, D, E, F. This is the identification of hexadecimal. Its values ​​look like this (10 A8) 16 plus (A1.03) 16 decimal number  The process of converting a system to a hexadecimal number system is also very simple. Let's look at some examples.

512=2x162+0x161+0x160=200