diff --git a/Structures/Functions/count.cpp b/Structures/Functions/count.cpp new file mode 100644 index 0000000..2deeebd --- /dev/null +++ b/Structures/Functions/count.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; +int inp = 1; + +vector printcount(int n) +{ + vector vec; + if (inp <= n) + { + vec.push_back(inp); + inp++; + printcount(n); + } + return vec; +} +int main() +{ + int n; + cin >> n; + + printcount(n); + for (auto it : vec) + { + cout << it << " "; + } + return 0; +} \ No newline at end of file diff --git a/Structures/Functions/count.exe b/Structures/Functions/count.exe new file mode 100644 index 0000000..b14534b Binary files /dev/null and b/Structures/Functions/count.exe differ diff --git a/Structures/Recursion/printcountwithoutloop.cpp b/Structures/Recursion/printcountwithoutloop.cpp new file mode 100644 index 0000000..3ee8283 --- /dev/null +++ b/Structures/Recursion/printcountwithoutloop.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; +vector printnumber(int x) +{ + + vector vec; + vec.push_back(x); + + if (x != 0) + { + x--; + printnumber(x); + vec.push_back(x); + } + return vec; +} +int main() +{ + int x; + cin >> x; + vector result = printnumber(x); + for (int num : result) + { + cout << num << " "; + } + cout << endl; +} \ No newline at end of file diff --git a/Structures/Recursion/printcountwithoutloop.exe b/Structures/Recursion/printcountwithoutloop.exe new file mode 100644 index 0000000..6abe88a Binary files /dev/null and b/Structures/Recursion/printcountwithoutloop.exe differ