#include <iostream> using namespace std; int initialValue; void IncreaseNumber(int n){ if(n == initialValue){ return; } n += 5; cout << n << " "; IncreaseNumber(n); } void DecreaseNumber(int n){ if(n <= 0){ cout << n << " "; IncreaseNumber(n); return; } cout << n << " "; n -= 5; DecreaseNumber(n); } int main() { cin >> initialValue; DecreaseNumber(initialValue); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter