SlideShare a Scribd company logo
SUGGESTED BY
Santoshichakraborty
ma’am
RECUSION OF FUCTIONS
Swami Shri Swaroopanand Saraswati
Mahavidyalaya
Session 2023-24
PRESENTED BY
PushpitaSahu
MSc IV Sem
CONTENTS :-
 Introduction
 Definitionof recusion
 Example of recusion
 Application
 References
INTRODUCTION :-
Recursion is a programming concept where a function
calls itself in its own definition. It involves breaking a
problem into smaller, similar subproblems and solving
them.
DEFINITION OF RECUSION:-
 In C programming, recursion is a technique where a function calls itself either
directly or indirectly to solve a smaller instance of the same problem. It involves
breaking down a complex problem into simpler subproblems and solving them
iteratively. Recursion typically consists of two parts
 Base Case: It is the simplest form of the problem that can be directly solved
without further recursion. The recursive function checks for this base case to
stop the recursion.
 Recursive Case: It involves breaking down the original problem into smaller,
similar subproblems and solving each of them by making recursive calls to the
same function.
 Here's a simple example of a recursive function in C:
EXAMPLE OFRECUSION :-
/*Write a program to find factorial by using recusion
#include <stdio.h>
long int factorial(int n);
void main() {
int n, result;
printf("Enter a number: ");
scanf("%d", &n);
result = factorial(n);
printf("The factorial of %d is %ld", n,
result);
getch();
}
int factorial(int n) {
Long int fact;
if ( n = = 1) {
return 1;
} else {
fact =n * factorial(n - 1);
return(fact);
}
}
APPLICATION:-
Application or use of recursion
 Mathematical Calculations: Recursion is often used for
mathematical calculations, such as calculating factorials,
Fibonacci numbers, and combinations.
 Tree and Graph Traversals: Recursive algorithms are
efficient for traversing tree structures or graphs.
 Dynamic Programming: Recursion is a key concept in
dynamic programming, where a complex problem is
broken down into simpler subproblems, and solutions to
subproblems are cached for efficiency.
REFERENCE:-
 Programming In ANSI C E.
Balagurusamy
THANK
YOU!

More Related Content

PPTX
pushjfjfjfjkdkjcjdkskjxjjsjdhxjzjzjpita sahu.pptx
PPTX
newnsnznznxjsjzjjxjsjxhajjzjsjzjsjzjz.pptx
PPTX
recursion, syntax, types, example program
PPT
Divide and conquer algorithm
PDF
Recursion
PPT
lecture 10 Recursive Function and Macros.ppt
PPTX
4. Recursion - Data Structures using C++ by Varsha Patil
PDF
Divide&Conquer & Dynamic Programming
pushjfjfjfjkdkjcjdkskjxjjsjdhxjzjzjpita sahu.pptx
newnsnznznxjsjzjjxjsjxhajjzjsjzjsjzjz.pptx
recursion, syntax, types, example program
Divide and conquer algorithm
Recursion
lecture 10 Recursive Function and Macros.ppt
4. Recursion - Data Structures using C++ by Varsha Patil
Divide&Conquer & Dynamic Programming

Similar to nebnznsnshsjsjsjsjsjssjsjsjsjsjsjsjdjw 2.pptx (20)

PPT
Chap14
PPTX
Lecture_7_StackAndRecursion (1).pptx
DOC
PROBLEM SOLVING TECHNIQUES
PDF
12200224070_Adnan_Ahmed_DAAbhbhbh_63.pdf
PPT
Recursion.ppt
PPTX
Advanced-Algorithmic-Analysis-CIA-II presentation.pptx
PPT
9781285852744 ppt ch15
PPSX
Function in c
PPTX
9. DBMS Experiment Laboratory PresentationPPT
PPTX
Python recursion
PPTX
Recursive Algorithms with their types and implementation
PPT
Recursion - Algorithms and Data Structures
PPT
algo_vc_lecture8.ppt
PPT
Data Structures- Part5 recursion
PDF
Linear Programming Problems {Operation Research}
PPTX
Dynamic programming prasintation eaisy
PDF
Ch11_LPIntro.pdf
PPTX
Use Of Calculus In Programming
PDF
Software Frameworks
PDF
Linear programming class 12 investigatory project
Chap14
Lecture_7_StackAndRecursion (1).pptx
PROBLEM SOLVING TECHNIQUES
12200224070_Adnan_Ahmed_DAAbhbhbh_63.pdf
Recursion.ppt
Advanced-Algorithmic-Analysis-CIA-II presentation.pptx
9781285852744 ppt ch15
Function in c
9. DBMS Experiment Laboratory PresentationPPT
Python recursion
Recursive Algorithms with their types and implementation
Recursion - Algorithms and Data Structures
algo_vc_lecture8.ppt
Data Structures- Part5 recursion
Linear Programming Problems {Operation Research}
Dynamic programming prasintation eaisy
Ch11_LPIntro.pdf
Use Of Calculus In Programming
Software Frameworks
Linear programming class 12 investigatory project
Ad

Recently uploaded (20)

PDF
Data Engineering Interview Questions & Answers Batch Processing (Spark, Hadoo...
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PDF
Transcultural that can help you someday.
PPTX
Copy of 16 Timeline & Flowchart Templates – HubSpot.pptx
PDF
Business Analytics and business intelligence.pdf
PDF
Optimise Shopper Experiences with a Strong Data Estate.pdf
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PPTX
CYBER SECURITY the Next Warefare Tactics
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
PPTX
importance of Data-Visualization-in-Data-Science. for mba studnts
PPTX
STERILIZATION AND DISINFECTION-1.ppthhhbx
PPTX
IMPACT OF LANDSLIDE.....................
PPT
lectureusjsjdhdsjjshdshshddhdhddhhd1.ppt
PDF
annual-report-2024-2025 original latest.
PPTX
Managing Community Partner Relationships
PPTX
QUANTUM_COMPUTING_AND_ITS_POTENTIAL_APPLICATIONS[2].pptx
PDF
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
PPTX
Market Analysis -202507- Wind-Solar+Hybrid+Street+Lights+for+the+North+Amer...
DOCX
Factor Analysis Word Document Presentation
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Data Engineering Interview Questions & Answers Batch Processing (Spark, Hadoo...
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Transcultural that can help you someday.
Copy of 16 Timeline & Flowchart Templates – HubSpot.pptx
Business Analytics and business intelligence.pdf
Optimise Shopper Experiences with a Strong Data Estate.pdf
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
CYBER SECURITY the Next Warefare Tactics
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
importance of Data-Visualization-in-Data-Science. for mba studnts
STERILIZATION AND DISINFECTION-1.ppthhhbx
IMPACT OF LANDSLIDE.....................
lectureusjsjdhdsjjshdshshddhdhddhhd1.ppt
annual-report-2024-2025 original latest.
Managing Community Partner Relationships
QUANTUM_COMPUTING_AND_ITS_POTENTIAL_APPLICATIONS[2].pptx
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
Market Analysis -202507- Wind-Solar+Hybrid+Street+Lights+for+the+North+Amer...
Factor Analysis Word Document Presentation
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Ad

nebnznsnshsjsjsjsjsjssjsjsjsjsjsjsjdjw 2.pptx

  • 1. SUGGESTED BY Santoshichakraborty ma’am RECUSION OF FUCTIONS Swami Shri Swaroopanand Saraswati Mahavidyalaya Session 2023-24 PRESENTED BY PushpitaSahu MSc IV Sem
  • 2. CONTENTS :-  Introduction  Definitionof recusion  Example of recusion  Application  References
  • 3. INTRODUCTION :- Recursion is a programming concept where a function calls itself in its own definition. It involves breaking a problem into smaller, similar subproblems and solving them.
  • 4. DEFINITION OF RECUSION:-  In C programming, recursion is a technique where a function calls itself either directly or indirectly to solve a smaller instance of the same problem. It involves breaking down a complex problem into simpler subproblems and solving them iteratively. Recursion typically consists of two parts  Base Case: It is the simplest form of the problem that can be directly solved without further recursion. The recursive function checks for this base case to stop the recursion.  Recursive Case: It involves breaking down the original problem into smaller, similar subproblems and solving each of them by making recursive calls to the same function.  Here's a simple example of a recursive function in C:
  • 5. EXAMPLE OFRECUSION :- /*Write a program to find factorial by using recusion #include <stdio.h> long int factorial(int n); void main() { int n, result; printf("Enter a number: "); scanf("%d", &n); result = factorial(n);
  • 6. printf("The factorial of %d is %ld", n, result); getch(); } int factorial(int n) { Long int fact; if ( n = = 1) { return 1; } else { fact =n * factorial(n - 1); return(fact); } }
  • 7. APPLICATION:- Application or use of recursion  Mathematical Calculations: Recursion is often used for mathematical calculations, such as calculating factorials, Fibonacci numbers, and combinations.  Tree and Graph Traversals: Recursive algorithms are efficient for traversing tree structures or graphs.  Dynamic Programming: Recursion is a key concept in dynamic programming, where a complex problem is broken down into simpler subproblems, and solutions to subproblems are cached for efficiency.
  • 8. REFERENCE:-  Programming In ANSI C E. Balagurusamy