{"id":"78c1fe48-c741-4e70-a28c-21739efe8d7b","name":"Basics Of Bit Manipulation","description":"1. You are given a number n.\r\n2. Print the number produced on setting its i-th bit.\r\n3. Print the number produced on unsetting its j-th bit.\r\n4. Print the number produced on toggling its k-th bit.\r\n5. Also, Check if its m-th bit is on or off. Print 'true' if it is on, otherwise print 'false'.","inputFormat":"A number\r\nFour numbers i,j,k,m.","outputFormat":"Check the sample ouput and question video.","constraints":"1 &lt;= n &lt;= 10^9\r\n1 &lt;= i &lt;= 9\r\n1 &lt;= j &lt;= 9\r\n1 &lt;= k &lt;= 9\r\n1 &lt;= m &lt;= 9","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n int n,i,j,k,m;\n cin>>n>>i>>j>>k>>m;\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 int i = scn.nextInt();\r\n int j = scn.nextInt();\r\n int k = scn.nextInt();\r\n int m = scn.nextInt();\r\n \r\n //write your code here\r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"57\r\n3 \r\n3 \r\n3 \r\n3","sampleOutput":"57\r\n49\r\n49\r\ntrue\r\n","questionVideo":"https://www.youtube.com/embed/v62IKeJtj0k?end=3223","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":"1908c6ab-12b4-4b43-b091-f1e240fdf148","name":"Basics Of Bit Manipulation","slug":"basics-of-bit-manipulation","type":1}],"next":{"id":"8f4bfebb-d7c5-4c2e-9836-e9d914c8629c","name":"Basics Of Bit Manipulation MCQ","type":0,"slug":"basics-of-bit-manipulation-mcq"},"prev":null}}

Basics Of Bit Manipulation

1. You are given a number n. 2. Print the number produced on setting its i-th bit. 3. Print the number produced on unsetting its j-th bit. 4. Print the number produced on toggling its k-th bit. 5. Also, Check if its m-th bit is on or off. Print 'true' if it is on, otherwise print 'false'.

{"id":"78c1fe48-c741-4e70-a28c-21739efe8d7b","name":"Basics Of Bit Manipulation","description":"1. You are given a number n.\r\n2. Print the number produced on setting its i-th bit.\r\n3. Print the number produced on unsetting its j-th bit.\r\n4. Print the number produced on toggling its k-th bit.\r\n5. Also, Check if its m-th bit is on or off. Print 'true' if it is on, otherwise print 'false'.","inputFormat":"A number\r\nFour numbers i,j,k,m.","outputFormat":"Check the sample ouput and question video.","constraints":"1 &lt;= n &lt;= 10^9\r\n1 &lt;= i &lt;= 9\r\n1 &lt;= j &lt;= 9\r\n1 &lt;= k &lt;= 9\r\n1 &lt;= m &lt;= 9","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n int n,i,j,k,m;\n cin>>n>>i>>j>>k>>m;\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 int i = scn.nextInt();\r\n int j = scn.nextInt();\r\n int k = scn.nextInt();\r\n int m = scn.nextInt();\r\n \r\n //write your code here\r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"57\r\n3 \r\n3 \r\n3 \r\n3","sampleOutput":"57\r\n49\r\n49\r\ntrue\r\n","questionVideo":"https://www.youtube.com/embed/v62IKeJtj0k?end=3223","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":"1908c6ab-12b4-4b43-b091-f1e240fdf148","name":"Basics Of Bit Manipulation","slug":"basics-of-bit-manipulation","type":1}],"next":{"id":"8f4bfebb-d7c5-4c2e-9836-e9d914c8629c","name":"Basics Of Bit Manipulation MCQ","type":0,"slug":"basics-of-bit-manipulation-mcq"},"prev":null}}
plane

Editor


Loading...

Basics Of Bit Manipulation

easy

1. You are given a number n. 2. Print the number produced on setting its i-th bit. 3. Print the number produced on unsetting its j-th bit. 4. Print the number produced on toggling its k-th bit. 5. Also, Check if its m-th bit is on or off. Print 'true' if it is on, otherwise print 'false'.

Constraints

1 <= n <= 10^9 1 <= i <= 9 1 <= j <= 9 1 <= k <= 9 1 <= m <= 9

Format

Input

A number Four numbers i,j,k,m.

Output

Check the sample ouput and question video.

Example

Sample Input

57 3 3 3 3

Sample Output

57 49 49 true

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode