Question
C PROGRAM 1- WAP to find factorial of given number using recursion Description: Read number n from user. Validate the given number Call main function
C PROGRAM
1- WAP to find factorial of given number using recursion
Description:
Read number n from user.
Validate the given number
Call main function from main for calculating factorial.
Prompt for continue option without using loop.
Pr-requisites:-
Storage Classes
Recursions
Objective: -
To understand the concept of Recursion and static keyword
Inputs: -
Positive integer N
Sample execution: - Test Case 1: user@emertxe] ./factorial Enter the value of N : 7 Factorial of the given number is 5040 Test Case 2: Enter the value of N : 5 Factorial of the given number is 120 Test case 3: Enter the value of N : -1 Invalid Input Test case 4: Enter the value of N : 0
Factorial of the given number is 1
requested file
#include
int main() { static int num; static unsigned long long int fact = 1; main(); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started