This program is for Factorial using recursive function. This program is part of Mumbai University MCA Colleges C Programs MCA Sem 1
#include<stdio.h>
#include<conio.h>
int sum=1;
int fact(int x)
{
if(x==0)
return sum;
sum=x*fact(x-1);
}
void main()
{
int n;
clrscr();
printf("Enter the value of n\n");
scanf("%d",&n);
printf("\nFactorial of the number is : %d",fact(n));
getch();
}
Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.
#include<stdio.h>
#include<conio.h>
int sum=1;
int fact(int x)
{
if(x==0)
return sum;
sum=x*fact(x-1);
}
void main()
{
int n;
clrscr();
printf("Enter the value of n\n");
scanf("%d",&n);
printf("\nFactorial of the number is : %d",fact(n));
getch();
}
Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.
Download
No comments:
Post a Comment