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.

jhasaurabh312 | 138 |

Aaaaarohiiii | 136 |

Harsha_kunchala | 128 |

tushki | 124 |

RajaRajput | 117 |

ARUN_PUNDIR | 617 |

manishgupta8497 | 607 |

Abhimanyu_kumar | 559 |

KhyatiSoneji | 501 |

Aman___Jain | 496 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.