FREE CODES
BYTES WITH LOGIC
Factorial program
#include
main()
{
int n,i;
int fact(int n);
printf("Enter the number : ");
scanf("%d",&n);
printf("\nThe factorial of the given number is %d\n",fact(n));
}
int fact(int f)
{
if ((f==0)(f==1))
return 1;
else
return (f*(fact(f-1)));
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment