`{"id":"399661c5-c369-4150-a939-b9d3a145c11b","name":"Print Increasing","description":"1. You are given a positive number n. \r\n2. You are required to print the counting from 1 to n.\r\n3. You are required to not use any loops. Complete the body of print Increasing function to achieve it. Don't change the signature of the function.\r\n\r\nNote -> The online judge can't force you to write the function recursively but that is what the spirit of question is. Write recursive and not iterative logic. The purpose of the question is to aid learning recursion and not test you.","inputFormat":"A number n","outputFormat":"1\r\n2\r\n3\r\n..\r\nn","constraints":"1 &lt;= n &lt;= 1000","sampleCode":{"cpp":{"code":"#include<iostream>\r\nusing namespace std;\r\n\r\nvoid printIncreasing(int n){\r\n // write your code here\r\n \r\n}\r\n\r\n\r\nint main(){\r\n int n; cin>>n;\r\n printIncreasing(n);\r\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) throws Exception {\r\n // write your code here\r\n }\r\n\r\n public static void printIncreasing(int n){\r\n \r\n }\r\n\r\n}"},"python":{"code":"def printDecreasing(n):\n # write your code here\n\nn = int(input())\nprintDecreasing(n)"}},"points":10,"difficulty":"easy","sampleInput":"5","sampleOutput":"1\r\n2\r\n3\r\n4\r\n5","questionVideo":"https://www.youtube.com/embed/Y5IobAWmfjQ","hints":[],"associated":[{"id":"3d924744-2fb9-4093-8cdc-1fd046775ada","name":"(Print Increasing) What will be the base condition?","slug":"print-increasing-what-will-be-the-base-condition","type":4},{"id":"8dd02518-cb37-4283-ab6a-a18203ac59c3","name":"(Print Increasing) Which data structure module is used in this question?","slug":"print-increasing-which-data-structure-module-is-used-in-this-question","type":4},{"id":"bd5c9a8c-a362-4850-bb5a-a0c519942aa9","name":"(Print Increasing) What will be the time complexity of this problem?","slug":"print-increasing-what-will-be-the-time-complexity-of-this-problem","type":4},{"id":"bdf1bc42-b5c7-4f4a-a10f-51b8e9e6c7fd","name":"(Print Increasing) What will be the output if n=4?","slug":"print-increasing-what-will-be-the-output-if-n-4","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":"d341a7c9-1269-409c-b851-0bb512289544","name":"Recursion And Backtracking For Beginners","slug":"recursion-and-backtracking-for-beginners","type":0},{"id":"13be68bd-68ff-4363-a3cc-9d49e8f5ca8e","name":"Print Increasing","slug":"print-increasing","type":1}],"next":{"id":"dee28cf8-30a1-4f11-b618-39cd553d96dc","name":"Print Increasing","type":3,"slug":"print-increasing"},"prev":{"id":"e32076e8-b111-4dbe-a514-2e7782981dc8","name":"Print Decreasing","type":3,"slug":"print-decreasing"}}}`

# Print Increasing

1. You are given a positive number n. 2. You are required to print the counting from 1 to n. 3. You are required to not use any loops. Complete the body of print Increasing function to achieve it. Don't change the signature of the function. Note -> The online judge can't force you to write the function recursively but that is what the spirit of question is. Write recursive and not iterative logic. The purpose of the question is to aid learning recursion and not test you.

`{"id":"399661c5-c369-4150-a939-b9d3a145c11b","name":"Print Increasing","description":"1. You are given a positive number n. \r\n2. You are required to print the counting from 1 to n.\r\n3. You are required to not use any loops. Complete the body of print Increasing function to achieve it. Don't change the signature of the function.\r\n\r\nNote -> The online judge can't force you to write the function recursively but that is what the spirit of question is. Write recursive and not iterative logic. The purpose of the question is to aid learning recursion and not test you.","inputFormat":"A number n","outputFormat":"1\r\n2\r\n3\r\n..\r\nn","constraints":"1 &lt;= n &lt;= 1000","sampleCode":{"cpp":{"code":"#include<iostream>\r\nusing namespace std;\r\n\r\nvoid printIncreasing(int n){\r\n // write your code here\r\n \r\n}\r\n\r\n\r\nint main(){\r\n int n; cin>>n;\r\n printIncreasing(n);\r\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) throws Exception {\r\n // write your code here\r\n }\r\n\r\n public static void printIncreasing(int n){\r\n \r\n }\r\n\r\n}"},"python":{"code":"def printDecreasing(n):\n # write your code here\n\nn = int(input())\nprintDecreasing(n)"}},"points":10,"difficulty":"easy","sampleInput":"5","sampleOutput":"1\r\n2\r\n3\r\n4\r\n5","questionVideo":"https://www.youtube.com/embed/Y5IobAWmfjQ","hints":[],"associated":[{"id":"3d924744-2fb9-4093-8cdc-1fd046775ada","name":"(Print Increasing) What will be the base condition?","slug":"print-increasing-what-will-be-the-base-condition","type":4},{"id":"8dd02518-cb37-4283-ab6a-a18203ac59c3","name":"(Print Increasing) Which data structure module is used in this question?","slug":"print-increasing-which-data-structure-module-is-used-in-this-question","type":4},{"id":"bd5c9a8c-a362-4850-bb5a-a0c519942aa9","name":"(Print Increasing) What will be the time complexity of this problem?","slug":"print-increasing-what-will-be-the-time-complexity-of-this-problem","type":4},{"id":"bdf1bc42-b5c7-4f4a-a10f-51b8e9e6c7fd","name":"(Print Increasing) What will be the output if n=4?","slug":"print-increasing-what-will-be-the-output-if-n-4","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":"d341a7c9-1269-409c-b851-0bb512289544","name":"Recursion And Backtracking For Beginners","slug":"recursion-and-backtracking-for-beginners","type":0},{"id":"13be68bd-68ff-4363-a3cc-9d49e8f5ca8e","name":"Print Increasing","slug":"print-increasing","type":1}],"next":{"id":"dee28cf8-30a1-4f11-b618-39cd553d96dc","name":"Print Increasing","type":3,"slug":"print-increasing"},"prev":{"id":"e32076e8-b111-4dbe-a514-2e7782981dc8","name":"Print Decreasing","type":3,"slug":"print-decreasing"}}}`

Editor

# Print Increasing

easy

1. You are given a positive number n. 2. You are required to print the counting from 1 to n. 3. You are required to not use any loops. Complete the body of print Increasing function to achieve it. Don't change the signature of the function. Note -> The online judge can't force you to write the function recursively but that is what the spirit of question is. Write recursive and not iterative logic. The purpose of the question is to aid learning recursion and not test you.

1 <= n <= 1000

A number n

1 2 3 .. n

## 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;}5`

### 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;}1 2 3 4 5```

Question Video

Discussions

Show Discussion

Related Resources