Converting Decimal number to binary number through recursion in C

Ad

Converting Decimal number to binary number through recursion in C

Converting Decimal number to binary number through recursion in C

Converting Decimal number to binary number through recursion in C


Explanation:

Binary of 17=10001

K=17<<i
K=17<<31 = 0
K=17<<30 = 0
K=17<<29 =0
K=17<<28 = 0
K=17<<27 = 0
K=17<<26 = 0
K=17<<25 = 0
K=17<<24 = 0
K=17<<23 = 0
K=17<<22 = 0
K=17<<21 = 0
K=17<<20 = 0
K=17<<19 = 0
K=17<<18 = 0
K=17<<17 = 0
K=17<<16 = 0
K=17<<15 = 0
K=17<<14 = 0
K=17<<13 = 0
K=17<<12 = 0
K=17<<11 = 0
K=17<<10 = 0
K=17<<9 = 0
K=17<<8 = 0
K=17<<7 = 0
K=17<<6 = 0
K=17<<5 = 0
K=17<<4 = 1 (001)
K=17<<3 = 2 (010)
K=17<<2 = 4 (100)
K=17<<1 = 8 (1000)
K=17<<0 = 17 (10001)

On solving k & 1:

1 & 1 = 1
1 & 2 = 0
1 & 4 = 0
1 & 8 = 0
1 & 17 = 1

Here comes the binary of 17 i.e. 10001.

0 Response to "Converting Decimal number to binary number through recursion in C"

Post a Comment

If you have any doubts, please let me know...

Ads Atas Artikel

Ads Center 1

Ads Center 2

Ads Center 3