recursion questions in c

Solutions on MaxInterview for recursion questions in c by the best coders in the world

showing results for - "recursion questions in c"
Catalina
30 Sep 2017
1#include <stdio.h>
2
3unsigned long long int factorial(unsigned int i) {
4
5   if(i <= 1) {
6      return 1;
7   }
8   return i * factorial(i - 1);
9}
10
11int  main() {
12   int i = 12;
13   printf("Factorial of %d is %d\n", i, factorial(i));
14   return 0;
15}
Aitana
17 Jan 2020
1#include <stdio.h>
2int sum(int n);
3
4int main() {
5    int number, result;
6
7    printf("Enter a positive integer: ");
8    scanf("%d", &number);
9
10    result = sum(number);
11
12    printf("sum = %d", result);
13    return 0;
14}
15
16int sum(int n) {
17    if (n != 0)
18        // sum() function calls itself
19        return n + sum(n-1); 
20    else
21        return n;
22}
23
Ana Paula
09 Feb 2017
1#include <stdio.h>
2
3int fibonacci(int i) {
4
5   if(i == 0) {
6      return 0;
7   }
8	
9   if(i == 1) {
10      return 1;
11   }
12   return fibonacci(i-1) + fibonacci(i-2);
13}
14
15int  main() {
16
17   int i;
18	
19   for (i = 0; i < 10; i++) {
20      printf("%d\t\n", fibonacci(i));
21   }
22	
23   return 0;
24}
queries leading to this page
c recursion programsrecursion in c questions and answersc factorial recursiverecursive finctions in cwhat is recursion in cfactorial program in c without using recursionquestions for recursion factorial in c with recursionrecursion i cc 2b 2b recursion practicerecursion in c programming examplefactorial program in c recursionrecursion problems in cfactorial with recusrsion in cc language in recursionrecursive function exercisesprogram on recursion in cfactorial program in c using recursionbasic questions on recursion for practicerecursive in c peoblemsrecursion questionsrecursion program in cpractise c recursion questionsrecursion in c programming codeexample of recursion in c programmingquestions about recursion functions in cways to do recursion in chow to caculate a recursive version time in factorial in c programmingc programming recursionfunction and recursion in crecursion output questions in cc language solution to recursionsrecursion in crecursion in c geeksforgeeksrecursion programs in crecursion cc program 1 to 4 recursionrecursion in c programming questionsrecursion in c examplerecursion in c functions 7cc language tutorialsrecursion c problemshow to caculate a recursive version time in factorial in c programming coderecursion exercises cc programs using recursiongood questions on recursion in cfactorial in c using recursionrecursion example in crecursion examples crecursion exerciserecursion in c problemsexplain recursion with example in crecursion in c examplesrecursion program practicproblems on recursion in crecursion codes for practicehow to get the solution out from a recursion in crecursion function example in cfunctions recursion in cwhat are recursion in cexample of recursion in cquestions on recursion in crecursion in c programmingpractice c recursionfunction in c recursionusing recursion print find factorial in cproblems on recursion cfind factorial with recursion in chow to clculate a recursive time in factorial in c programmingfactorial of a given number using the recursive function call in crecursion c programwhat is recursion in programming crecursion exercisessimple recursion program in crecursion questions in crecursion codes for practice in cfactorial using recursion c programquestions on recursive functions in cexplain recursion in c with examplerecursion problem solving in chow to solve recursion problems in cexercise on recursive functions in cwhat is a recursion in cinterview questions on recursion in cprogram of recursion in crecursion function cc program to find factorial of a number using recursionrecursion practice problems in cc problems on recursionrecursion problem in crecursion in c with functionrecursion c programmingrecursion c program examplesprograms using recursion in cexamples of recursion in ccode recursion in cfind factorial of a number in c using recursion with furecursive function tasksrecursion means in c languagesc questions on recursionhow to understand recursion in cpractice exercises on recursive functions crecursion definition in cdefine recursion in ctough questions on recursionrecursive function in c exerciseswhat are recursions in programming crecursive programming crecursion tree in cfunction recursion in cc recursion programrecursive factorial cbest exercises for recursion in programmingfactorial recursive crecursion function in chow to do recursion in crecursion c examplesfactorial using recursion in cwhat is recursion with example in crecursion program practicerecursion in c questionsrecursion questions gfgbasic recursion problems in cfactorial using non recursive function algorithm in cfind factorial of a number in c using recursionrecursion questions in c