Jan
17
#include<conio.h>
#include<stdio.h>
int fac(int);
void main(){
int num;
printf(“Enter number to get factorial: “);
scanf(“%d”,&num);
num=fac(num);
printf(“Sum is: %d”,num);
}
int fac(int n){
if (n==1)
return 1;
else
return (n*fac(n-1));
}
Leave a Reply
No Comments