ADS

C Program To Find Factorial Using Function | C programming

C Program To Find Factorial Using Function

#include<stdio.h>
long int fact(int);
int main()
{
    int n;
    printf("Enter number");
    scanf("%d",&n);
    printf("%d!=%ld\n",n,fact(n));
}
long int fact(int n)
{
    if(n<=1)
        return 1;
    else
        return (n*fact(n-1));
}

OUTPUT

C program to find factorial using function

Post a Comment

0 Comments