Associated Course(s):
Sudo Placement 2019

You are given a decimal number **n. **You need to find the gray code of the number n and convert it into decimal.

To see how it's done, refer here.

**Input:**

The first line contains an integer **T,** the number of test cases. For each test case, there is an integer **n **denoting the number

**Output:**

For each test case, the output is gray code equivalent of **n.**

**Constraints:**

1 <= T <= 100

0 <= n <= 10^{8}

**Example:
Input**

2

7

10

4

15

**Explanation:
Testcase1: **7 is represented as 111 in binary form. The gray code of 111 is 100, in the binary form whose decimal equivalent is 4.

**Testcase2: **10 is represented as 1010 in binary form. The gray code of 1010 is 1111, in the binary form whose decimal equivalent is 15.

Author: Vanshika_pec

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

sabka_din_aayega | 317 |

maggiiiii | 248 |

thanuvinu94 | 211 |

Savage_19 | 206 |

Anugrah_kumar | 172 |

Bishnu Dev Panda | 803 |

sabka_din_aayega | 628 |

Anugrah_kumar | 562 |

okayboss | 561 |

maggiiiii | 531 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.