How to find factorial of N using while?

CODE




How to find factorial of N using while?
int main()
{
    int i=1,fact=1,n;
    printf("\n enter the value of n=");
    scanf("%d",&n);
    while(i<=n)
    {
        fact*=i;
        i++;
    }
    printf("\n factorial=%d",fact);
}

Output:
enter the value of n=4

 factorial=24

How to find factorial of N using while? How to find factorial of N using while? Reviewed by Unknown on December 16, 2018 Rating: 5

No comments:

If you have any doubt or query ,comment below:

Programming copyright © 2018-19. Powered by Blogger.