+ 4
What would be the out put of following code. Can you reverse output while using same method.
2 Respuestas
+ 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! */
+ 2
very nice