{"id":"14041b6a-85d2-4e52-ae8b-bae01e8e40c0","name":"Reverse A Number","description":"1. You've to display the digits of a number in reverse.\r\n2. Take as input \"n\", the number for which digits have to be display in reverse.\r\n3. Print the digits of the number line-wise, but in reverse order.","inputFormat":"\"n\" where n is any integer.","outputFormat":"d1\r\nd2\r\nd3\r\n... digits of the number in reverse","constraints":"1 &lt;= n &lt; 10^9","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\n\r\nint main(int argc, char **argv){\r\n int n;\r\n cin >> n;\r\n\r\n //write your code here\r\n \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 // write your code here \r\n }\r\n }"},"python":{"code":"def reverse(n):\n # write your code here\n\ndef main():\n n = int(input())\n reverse(n)\n\nif __name__==\"__main__\":\n main()"}},"points":10,"difficulty":"easy","sampleInput":"65784383","sampleOutput":"3\r\n8\r\n3\r\n4\r\n8\r\n7\r\n5\r\n6","questionVideo":"https://www.youtube.com/embed/uYOIb1-47qw","hints":[],"associated":[{"id":"03d7a615-293e-4a5c-aeab-e1bea88b078d","name":"How to get the first digit of the number from the right side in an efficient way?","slug":"how-to-get-the-first-digit-of-the-number-from-the-right-side-in-an-efficient-way","type":4},{"id":"102e4227-e8a6-49b0-b9d3-c833413d0be0","name":"choose the correct one for given code in Reverse Number:","slug":"choose-the-correct-one-for-given-code-in-reverse-number","type":4},{"id":"af6bb8ca-64b8-4b11-b876-bb25c1611421","name":"choose the correct one in Reverse Number:","slug":"choose-the-correct-one-in-reverse-number","type":4}],"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":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"23f017bd-1c13-4b0a-94ae-ec24345c1fa1","name":"Reverse A Number","slug":"reverse-a-number","type":1}],"next":{"id":"63c89c25-699e-4c99-89cc-dff8b324a539","name":"Reverse a Number","type":3,"slug":"reverse-a-number"},"prev":{"id":"05c8c176-61f1-486f-a86f-22a3ef2e0c13","name":"Digits of a Number","type":3,"slug":"digits-of-a-number"}}}

Reverse A Number

1. You've to display the digits of a number in reverse. 2. Take as input "n", the number for which digits have to be display in reverse. 3. Print the digits of the number line-wise, but in reverse order.

{"id":"14041b6a-85d2-4e52-ae8b-bae01e8e40c0","name":"Reverse A Number","description":"1. You've to display the digits of a number in reverse.\r\n2. Take as input \"n\", the number for which digits have to be display in reverse.\r\n3. Print the digits of the number line-wise, but in reverse order.","inputFormat":"\"n\" where n is any integer.","outputFormat":"d1\r\nd2\r\nd3\r\n... digits of the number in reverse","constraints":"1 &lt;= n &lt; 10^9","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\n\r\nint main(int argc, char **argv){\r\n int n;\r\n cin >> n;\r\n\r\n //write your code here\r\n \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 // write your code here \r\n }\r\n }"},"python":{"code":"def reverse(n):\n # write your code here\n\ndef main():\n n = int(input())\n reverse(n)\n\nif __name__==\"__main__\":\n main()"}},"points":10,"difficulty":"easy","sampleInput":"65784383","sampleOutput":"3\r\n8\r\n3\r\n4\r\n8\r\n7\r\n5\r\n6","questionVideo":"https://www.youtube.com/embed/uYOIb1-47qw","hints":[],"associated":[{"id":"03d7a615-293e-4a5c-aeab-e1bea88b078d","name":"How to get the first digit of the number from the right side in an efficient way?","slug":"how-to-get-the-first-digit-of-the-number-from-the-right-side-in-an-efficient-way","type":4},{"id":"102e4227-e8a6-49b0-b9d3-c833413d0be0","name":"choose the correct one for given code in Reverse Number:","slug":"choose-the-correct-one-for-given-code-in-reverse-number","type":4},{"id":"af6bb8ca-64b8-4b11-b876-bb25c1611421","name":"choose the correct one in Reverse Number:","slug":"choose-the-correct-one-in-reverse-number","type":4}],"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":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"23f017bd-1c13-4b0a-94ae-ec24345c1fa1","name":"Reverse A Number","slug":"reverse-a-number","type":1}],"next":{"id":"63c89c25-699e-4c99-89cc-dff8b324a539","name":"Reverse a Number","type":3,"slug":"reverse-a-number"},"prev":{"id":"05c8c176-61f1-486f-a86f-22a3ef2e0c13","name":"Digits of a Number","type":3,"slug":"digits-of-a-number"}}}
plane

Editor


Loading...

Reverse A Number

easy

1. You've to display the digits of a number in reverse. 2. Take as input "n", the number for which digits have to be display in reverse. 3. Print the digits of the number line-wise, but in reverse order.

Constraints

1 <= n < 10^9

Format

Input

"n" where n is any integer.

Output

d1 d2 d3 ... digits of the number in reverse

Example

Sample Input

65784383

Sample Output

3 8 3 4 8 7 5 6

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode