- 5
Fill in the blanks to define a recursive print function that print number from n to 0
Void print(into n) If(n<0)......; Printf("%d", n); ......(n-1); } https://code.sololearn.com/c411v8s1hekg/?ref=app https://www.sololearn.com/discuss/1950334/?ref=app
10 Réponses
+ 5
Void print(int n)
If(n<0) return;
Printf("%d", n);
print(n-1);
}
+ 2
Void print(into n)
If(n<0) return;
Printf("%d", n);
print(n-1);
}
+ 1
int fact(int n) {
if (n == 1) return 1;
return n * fact(n - 1);
}
0
1.first we have to( return) given expression
2.then we would (print) it again,
till it will become zero.
0
void print (int n)
{
if (n < 0)
return;
printf ("%d", n);
print (n - 1);
}
//This will work.
0
good it is clear
0
Fill in the blanks to define a recursive print function that prints numbers from n to 0.
void print(int n) {
if (n < 0)
return
;
printf("%d", n);
print
(n - 1);
}
- 4
1 return
2 fact
- 6
1. In the First blank we have to return given expression.
2. Then at the second blank we need to call the it's function print function.
- 10
Tq