L Lan Anh New member Sep 18, 2021 #1 What will be the output of the following C code? Code: #include<stdio.h> main() { int n; n=f1(4); printf("%d",n); } f1(int x) { int b; if(x==1) return 1; else b=x*f1(x-1); return b; } A. 24 B. 4 C. 12 D. 10
What will be the output of the following C code? Code: #include<stdio.h> main() { int n; n=f1(4); printf("%d",n); } f1(int x) { int b; if(x==1) return 1; else b=x*f1(x-1); return b; } A. 24 B. 4 C. 12 D. 10
N Nguyễn Vân Anh New member Sep 18, 2021 #2 Answer: a Explanation: The above code returns the factorial of a given number using the method of recursion. The given number is 4 in the above code, hence the factorial of 4, that is, 24 will be returned. Upvote 0 Downvote
Answer: a Explanation: The above code returns the factorial of a given number using the method of recursion. The given number is 4 in the above code, hence the factorial of 4, that is, 24 will be returned.