i want questions from
programming in c
Answers
Answered by
0
Write a c program to find the factorial of a number using recursion function.
#include<stdio.h>
main()
{
long int factorial(int n);
int n;
printf("Enter the number n \n");
scanf("%d",&n);
factorial(n);
printf("\n the factorial of a number is %d", factorial(n));
}
long int factorial(int f)
{
long int fact;
if(f==1)
return(1);
else
fact=f*factorial(f-1);
return(fact);
}
#include<stdio.h>
main()
{
long int factorial(int n);
int n;
printf("Enter the number n \n");
scanf("%d",&n);
factorial(n);
printf("\n the factorial of a number is %d", factorial(n));
}
long int factorial(int f)
{
long int fact;
if(f==1)
return(1);
else
fact=f*factorial(f-1);
return(fact);
}
Similar questions
Physics,
8 months ago
Science,
8 months ago
English,
1 year ago
Math,
1 year ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago