🚀 From Python to placements — 90+ courses & 200+ exams, free on Leyaa.ai →

1. How to convert decimal to binary ?

The general formula to convert decimal to any number system,

Till number > 0

   Find number % base.

   Write down the result.

   Divide the number by base. i.e. number / base

Rewrite all remainders in reverse order.

Convert (15)10 to binary

Here base value = 2.

2|15
 ----
2|7    - 1
 ----
2|3    - 1
 ----
2|1    - 1

(1111)2

Convert (20)10 to binary

Here base value = 2.

2|20
 ----
2|10   - 0
 ----
2|5    - 0
 ----
2|2    - 1
 ----
  1   -  0

(10100)2



2. How to convert decimal to octal ?

Convert (34)10 to octal

Here base value = 8.

8|34
 ----
8|4    - 2

(42)8

Convert (456)10 to octal

8|456
 ----
8|57    - 0
 ----
8|7     - 1

(710)8



3. How to convert decimal to hexadecimal ?

Convert (255)10 to hexadecimal

Here base value = 16.

16|255
  ----
16|15    -  15

(15)(15)
(ff)16

🚀 Code smarter. Crack exams faster.

90+ interactive coding courses & 200+ competitive exam prep — powered by learning intelligence. All free.

Try Leyaa.ai Now →