`{"id":"c60926d4-e006-4619-96eb-44d62ff3aff0","name":"Print Value Of Rsb Mask","description":"1. You are given a number n.\r\n2. You have to print the right-most set bit mask. ","inputFormat":"A number n","outputFormat":"A number","constraints":"1 &lt;= n &lt;= 10^9","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\n\n\nvoid decToBinary(int n)\n{\n // write your code here\n}\n\n\nint main(){\n \n \n int n;\n cin>>n;\n char buffer[33];\n int k=(n&((~n)+1));\n decToBinary(k);\n \n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args){\r\n Scanner scn = new Scanner(System.in);\r\n int n = scn.nextInt();\r\n\r\n //write your code here\r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"58","sampleOutput":"10\r\n","questionVideo":"https://www.youtube.com/embed/XcSr6TIMl7w?end=158","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"f3e3dbef-d2b7-4f6d-b357-2ef3738e6c91","name":"Bit Manipulation For Intermediate","slug":"bit-manipulation-for-intermediate-9995","type":0},{"id":"2d15fc7b-3dd2-440e-9aa9-3111f0e9417b","name":"Print Value Of Rsb Mask","slug":"print-value-of-rsb-mask","type":1}],"next":{"id":"11d56ab2-19bd-4c7b-a282-9f5d71a95a48","name":"Print Value of Rsb Mask MCQ","type":0,"slug":"print-value-of-rsb-mask-mcq"},"prev":{"id":"6e942c05-fd5c-4456-b88a-b6dfb4bf2825","name":"Basics Of Bit Manipulation","type":3,"slug":"basics-of-bit-manipulation"}}}`

1. You are given a number n. 2. You have to print the right-most set bit mask.

`{"id":"c60926d4-e006-4619-96eb-44d62ff3aff0","name":"Print Value Of Rsb Mask","description":"1. You are given a number n.\r\n2. You have to print the right-most set bit mask. ","inputFormat":"A number n","outputFormat":"A number","constraints":"1 &lt;= n &lt;= 10^9","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\n\n\nvoid decToBinary(int n)\n{\n // write your code here\n}\n\n\nint main(){\n \n \n int n;\n cin>>n;\n char buffer[33];\n int k=(n&((~n)+1));\n decToBinary(k);\n \n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args){\r\n Scanner scn = new Scanner(System.in);\r\n int n = scn.nextInt();\r\n\r\n //write your code here\r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"58","sampleOutput":"10\r\n","questionVideo":"https://www.youtube.com/embed/XcSr6TIMl7w?end=158","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"f3e3dbef-d2b7-4f6d-b357-2ef3738e6c91","name":"Bit Manipulation For Intermediate","slug":"bit-manipulation-for-intermediate-9995","type":0},{"id":"2d15fc7b-3dd2-440e-9aa9-3111f0e9417b","name":"Print Value Of Rsb Mask","slug":"print-value-of-rsb-mask","type":1}],"next":{"id":"11d56ab2-19bd-4c7b-a282-9f5d71a95a48","name":"Print Value of Rsb Mask MCQ","type":0,"slug":"print-value-of-rsb-mask-mcq"},"prev":{"id":"6e942c05-fd5c-4456-b88a-b6dfb4bf2825","name":"Basics Of Bit Manipulation","type":3,"slug":"basics-of-bit-manipulation"}}}`

Editor

easy

1. You are given a number n. 2. You have to print the right-most set bit mask.

1 <= n <= 10^9

A number n

A number

Example

Sample Input

`.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}58`

Sample Output

```.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}10 ```

Question Video

Discussions

Show Discussion

Related Resources