One's Complement
Submissions: 823   Accuracy:

57.56%

  Difficulty: Basic   Marks: 1

Given an integer n, write a program to find the one’s complement of the integer.

Input:
The first line of the input contains an integer T denoting number of test cases. Each of the following T lines will contain an integer N.

Output:

For each test case, print one's complement of N in a new line.

Constraints:

1 <= T <= 104
1 <= N <= 106


Example:
Input
:
2
5
255
Output:
2
0

Explanation:
Testcase 1:If n=5, its decimal representation is 101 and its one's complement is 010 i.e, 2.

** For More Input/Output Examples Use 'Expected Output' option **

Author: ShivamKD


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.