+ 4

What would be the out put of following code. Can you reverse output while using same method.

https://code.sololearn.com/cs1SmGiMepmY/?ref=app

12th Jun 2017, 10:29 PM
Vivek Joshi
Vivek Joshi - avatar
2 ответов
+ 8
#include <iostream> using namespace std; void Func(int); void Funr(int y, int mx){ /* adding a second paramater */ Func(mx-y); /* reversing the count line */ cout<<endl; if(y>0) Funr(--y,mx); /* adapting the call with the second parameter */ return; } void Func(int x) { cout<<"*"; if(--x>=0) Func(x); return; } int main() { int r; cout<<"Enter Row no : "<<endl; cin>>r; int i= 0; Funr(r,r); /* first call with same value fir both parameters */ } /* ... and that's all, folks! */
13th Jun 2017, 1:27 AM
visph
visph - avatar
+ 2
very nice
13th Jun 2017, 6:27 PM
Vivek Joshi
Vivek Joshi - avatar