16
Loading subject content…
Loading subject content…
Loading practice questions…
What will be the output of the program?
#include <stdio.h>
int sum(int n) { return n == 0 ? 0 : n + sum(n - 1); }
int main(void) {
printf("%d\n", sum(5));
return 0;
}What will be the output of the program?
#include <stdio.h>
int fact(int n) { return n <= 1 ? 1 : n * fact(n - 1); }
int main(void) {
printf("%d\n", fact(6));
return 0;
}What will be the output of the program?
#include <stdio.h>
int fib(int n) { return n < 2 ? n : fib(n - 1) + fib(n - 2); }
int main(void) {
printf("%d\n", fib(10));
return 0;
}