### Discussion :: Bitwise Operators - Find Output of Program (Q.No.9)

Raju said: (Aug 19, 2010) | |

Here j=0x20 means 2 hexa decimals i,e 2*16=32, So now j=32 and given i value also 32. i=32 --> 100000 j=32 --> 100000 i|j --> 100000, So k=32 (applying | operator) i&j --> 100000, So l=32 (applying & operator) k^l --> 000000, So m=0 (applying ^ operator). |

Kunal said: (Aug 27, 2010) | |

Here one number is given in decimal and one in hexadecimal so, to get the result either convert decimal to hexadecimal or vice versa. Now converting hexadecimal 0x20 to decimal as 2*16^1+0*16^0=32 Now convert it into binary to get the result. |

Rajeev Kuamr said: (Mar 5, 2011) | |

Give me some more concept about convertion of hexadecimal to decimal. |

Priyanka said: (Mar 24, 2011) | |

Someone please explain how 0*20 means 2 hexa decimals. |

Jegan X said: (Jun 16, 2011) | |

In or operator 1+1 = 10 ? what will print for k. |

Anil said: (Sep 15, 2011) | |

Please explain 0x20 = 32 happens? |

Vikram said: (Sep 27, 2011) | |

i=32 =00100000 j=0x20=00100000 k=i(or)j ----> o/p is 32. l=i(and)j -----> o/p is 32. m=k(xor)j -----> o/p is o. since if both of i/P's are equal then o/p is low in xor logic. hence o/p is i,j,k,l,m = 32,32,32,32,0. Thank you. |

Rams said: (Nov 6, 2011) | |

j=0x20=(20)H hexadecimal to decimal=(2*16^1)+(0*16^0)=32+0=32; i=32; j=32; k=i|j=10000|10000=10000=32 l=1&j=10000&10000=32 m=k^i=10000^10000=00000=0 |

Mita said: (Jan 7, 2012) | |

Thanks Rams |

Arup said: (May 9, 2012) | |

@Priyanka 0x20 is a hexadecimal number First convert to Binary i.e 0010 0000 and make to decimal i.e. 32 |

Bhagyashri Ghalme said: (Aug 23, 2013) | |

I am not satisfied by the above answer. So please somebody help me to get perfect answer of the above question. |

Uday said: (Oct 2, 2013) | |

Please explain conversions on binary to decimal and decimal to hexadecimal and vice versa. |

Sonu said: (Oct 3, 2013) | |

In binary: 1=0000 2=0010 3=0011 4=0100 5=0101 6=0110 7=0111 ....... 15=1111. For decimal to binary: 0110 = start from left 0x 2(power 0)+1x 2(power 1)+1x 2(power 2)+0x 2(power3) = 0+2+4+0 = 6. For decimal to hexadecimal: 1=1 2=2 3=3 4=4 5=5 6=6 7=7 8=8 9=9 10=A 11=B 12=C 13=D 14=E 15=F May IT help you @UDAY. |

Abhinav said: (Apr 1, 2014) | |

What does x means 0x20? |

Sukanya said: (Feb 15, 2015) | |

Can anyone explain this answer correctly? |

Amit said: (Feb 19, 2015) | |

I think. B = B10101010; // B10101010 == 0xAA. We can break this binary code in two parts 1010 and 1010. Means B10101010 so 1010 = A and another 1010 = A. So we can use it as like 0x20. Means 2 = 0010 and 0 = 0000. Means 00100000 = 32. So finally 0x20 = 0010 0000 = 32. |

Charu said: (Aug 5, 2015) | |

Please explain the value of 0*80? |

Basamma said: (Oct 7, 2015) | |

Hi @Charu. We can write 80 as 1000 0000. Now assigning decimal value to above binary number as: 128 64 32 16 8 4 2 1. Means --> Value of 0*80 is 128. |

Amit said: (Nov 4, 2015) | |

Hi @Charu. Question--> 0*80 = 128. Answer --> Firstly we will separate 80 in 8 and 0. After that the binary number's of 8 and 0 are: 8 = 1000. 0 = 0000. Then combine these number's. 80 = 1000 0000. After that we will make decimal number for 1000 0000 with the help of this, 128 64 32 16 8 4 2 1. So 1000 0000 = 128. Finally 0*80 = 128. |

Ashmita said: (Dec 16, 2015) | |

Please explain 0x20 where is define 0*20 is a hexadecimal. |

Sameer said: (Apr 2, 2016) | |

@Ashmita. In C/C++ the hexadecimal numbers are written as 0x20. Here the 0x. Represents, it is a hexadecimal number Or hexadecimal numbers are always preceded by 0x. |

Manju said: (Aug 2, 2016) | |

@Ashmita. 4 bits equal to 1 hexadecimal digit. j variable having 0*20 is represented as 0010 0000 . Same as like integer variable i. k value after OR operation both i and j get same result 32 value. L also get 32 after performing AND operation b/t I & j; then, k with XOR operation. So, the result will be -> 32,32,32,32,32. |

Balag said: (Oct 6, 2016) | |

@Vikram. Your explanation is clear, Thanks. |

Mayur said: (Jan 11, 2017) | |

Your explanation is clear, Thanks @Raju. |

Sam said: (Jul 7, 2018) | |

How 100000!? 100000=100000 (32)? the answer should be 1000000 (64). |

Lokesh said: (Nov 23, 2018) | |

Here 0x20 means convert the decimal number to hexadecimal number we already know that 20 in hexadecimal as 32. |

Ashutosg said: (Jul 26, 2019) | |

Here j=0x20 means 2 hexa decimals i,e 2*16=32, So now j=32 and given i value also 32. i=32 --> 100000, j=32 --> 100000, i|j --> 100000, So k=32 (applying | operator), i&j --> 100000, So l=32 (applying & operator), k^l --> 000000, So m=0 (applying ^ operator). |

Nayan Vekariya said: (Jun 15, 2020) | |

0x20 means that, 16 * 2 = 32. So that 32 = 100000. 32 = 100000. K = 32 | 0x20 ==== 32 | 32 (true | true) L = 32 & 0x20 ==== 32 & 32 (true & true) M = 32 ^ 0x20 ==== 32 ^ 32 (true | false) So that 32, 32, 0. |

#### Post your comments here:

Name *:

Email : (optional)

» Your comments will be displayed only after manual approval.