Thursday, 18 June 2020

Decimal To Binary Conversion Using Stack

Stack can be used to convert a number into it's binary form.
  1. Push the remainder into stack after dividing the number by 2.
  2. Keep doing 1, till number>0.
  3. Pop the binary remainders 1/0 to get the binary form.
 Following is the program:

 

No comments:

Post a Comment