{"id":"1ec89d28-0e06-4ea9-8a2a-95f7adb5b1ec","name":"Any Base Subtraction","description":"1. You are given a base b.\r\n2. You are given two numbers n1 and n2 of base b.\r\n3. You are required to subtract n1 from n2 and print the value.","inputFormat":"A base b\r\nA number n1\r\nA number n2","outputFormat":"A number of base b equal in value to n2 - n1.","constraints":"2 &lt;= b &lt;= 10\r\n0 &lt;= n1 &lt;= 256\r\nn1 &lt;= n2 &lt;= 256","sampleCode":{"cpp":{"code":"#include<iostream>\r\nusing namespace std;\r\n\r\nint getDifference(int b, int n1, int n2){\r\n // write your code here\r\n \r\n}\r\n\r\n\r\nint main(){\r\n int b, n1, n2;\r\n cin>>b>>n1>>n2;\r\n getDifference(b,n1,n2);\r\n}"},"java":{"code":"import java.util.*;\r\n \r\n public class Main{\r\n \r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n int b = scn.nextInt();\r\n int n1 = scn.nextInt();\r\n int n2 = scn.nextInt();\r\n \r\n int d = getDifference(b, n1, n2);\r\n System.out.println(d);\r\n }\r\n \r\n public static int getDifference(int b, int n1, int n2){\r\n // write your code here\r\n }\r\n \r\n }"},"python":{"code":"def getDifference(base , n1 , n2):\n # write your code here\n\n \n\n\nif __name__ == '__main__':\n base = int(input())\n n1 = int(input())\n n2 = int(input())\n \n solution = getDifference(base , n1 , n2)\n print(solution)"}},"points":10,"difficulty":"easy","sampleInput":"8\r\n1\r\n100","sampleOutput":"77","questionVideo":"https://www.youtube.com/embed/J4mKYhm5r-A","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":"f10b54f1-0f44-408f-82d5-89c189f4ad57","name":"Function and Arrays","slug":"function-and-arrays","type":0},{"id":"48a7001c-e922-4ff7-9a76-9b3aef2ca60e","name":"Any Base Subtraction","slug":"any-base-subtraction","type":1}],"next":{"id":"1d28de58-d30c-4110-8f6a-cd99806ad904","name":"Any Base Subtraction","type":3,"slug":"any-base-subtraction"},"prev":{"id":"9779f8bf-91f4-4268-9783-1b340c9f1d23","name":"Any Base Addition","type":3,"slug":"any-base-addition"}}}

Any Base Subtraction

1. You are given a base b. 2. You are given two numbers n1 and n2 of base b. 3. You are required to subtract n1 from n2 and print the value.

{"id":"1ec89d28-0e06-4ea9-8a2a-95f7adb5b1ec","name":"Any Base Subtraction","description":"1. You are given a base b.\r\n2. You are given two numbers n1 and n2 of base b.\r\n3. You are required to subtract n1 from n2 and print the value.","inputFormat":"A base b\r\nA number n1\r\nA number n2","outputFormat":"A number of base b equal in value to n2 - n1.","constraints":"2 &lt;= b &lt;= 10\r\n0 &lt;= n1 &lt;= 256\r\nn1 &lt;= n2 &lt;= 256","sampleCode":{"cpp":{"code":"#include<iostream>\r\nusing namespace std;\r\n\r\nint getDifference(int b, int n1, int n2){\r\n // write your code here\r\n \r\n}\r\n\r\n\r\nint main(){\r\n int b, n1, n2;\r\n cin>>b>>n1>>n2;\r\n getDifference(b,n1,n2);\r\n}"},"java":{"code":"import java.util.*;\r\n \r\n public class Main{\r\n \r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n int b = scn.nextInt();\r\n int n1 = scn.nextInt();\r\n int n2 = scn.nextInt();\r\n \r\n int d = getDifference(b, n1, n2);\r\n System.out.println(d);\r\n }\r\n \r\n public static int getDifference(int b, int n1, int n2){\r\n // write your code here\r\n }\r\n \r\n }"},"python":{"code":"def getDifference(base , n1 , n2):\n # write your code here\n\n \n\n\nif __name__ == '__main__':\n base = int(input())\n n1 = int(input())\n n2 = int(input())\n \n solution = getDifference(base , n1 , n2)\n print(solution)"}},"points":10,"difficulty":"easy","sampleInput":"8\r\n1\r\n100","sampleOutput":"77","questionVideo":"https://www.youtube.com/embed/J4mKYhm5r-A","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":"f10b54f1-0f44-408f-82d5-89c189f4ad57","name":"Function and Arrays","slug":"function-and-arrays","type":0},{"id":"48a7001c-e922-4ff7-9a76-9b3aef2ca60e","name":"Any Base Subtraction","slug":"any-base-subtraction","type":1}],"next":{"id":"1d28de58-d30c-4110-8f6a-cd99806ad904","name":"Any Base Subtraction","type":3,"slug":"any-base-subtraction"},"prev":{"id":"9779f8bf-91f4-4268-9783-1b340c9f1d23","name":"Any Base Addition","type":3,"slug":"any-base-addition"}}}
plane

Editor


Loading...

Any Base Subtraction

easy

1. You are given a base b. 2. You are given two numbers n1 and n2 of base b. 3. You are required to subtract n1 from n2 and print the value.

Constraints

2 <= b <= 10 0 <= n1 <= 256 n1 <= n2 <= 256

Format

Input

A base b A number n1 A number n2

Output

A number of base b equal in value to n2 - n1.

Example

Sample Input

8 1 100

Sample Output

77

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode